+2005-06-16 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
+
+ * shell/ev-sidebar-links.c: (ev_sidebar_links_get_property),
+ (ev_sidebar_links_class_init), (ev_sidebar_links_get_label):
+ * shell/ev-sidebar-links.h:
+ * shell/ev-sidebar-page.c: (ev_sidebar_page_get_type),
+ (ev_sidebar_page_iface_init):
+ * shell/ev-sidebar-page.h:
+ * shell/ev-sidebar-thumbnails.c:
+ (ev_sidebar_thumbnails_get_property),
+ (ev_sidebar_thumbnails_class_init),
+ (ev_sidebar_thumbnails_set_document):
+ * shell/ev-sidebar-thumbnails.h:
+ * shell/ev-view.c: (ev_view_motion_notify_event):
+ * shell/ev-window.c: (update_chrome_visibility),
+ (ev_window_cmd_focus_page_selector),
+ (ev_window_update_fullscreen_popup), (view_actions_focus_in_cb),
+ (sidebar_page_main_widget_update_cb), (ev_window_init):
+
+ Autoraise toolbar on GoToPage binding and fix bindings in
+ EvSidebarThumbnails page.
+
2005-06-15 Christian Persch <chpe@cvs.gnome.org>
* shell/ev-properties.c: (update_progress_label):
enum {
PROP_0,
PROP_MODEL,
+ PROP_WIDGET,
};
case PROP_MODEL:
g_value_set_object (value, ev_sidebar_links->priv->model);
break;
+ case PROP_WIDGET:
+ g_value_set_object (value, ev_sidebar_links->priv->tree_view);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
"Current Model",
GTK_TYPE_TREE_MODEL,
G_PARAM_READWRITE));
+ g_object_class_override_property (g_object_class,
+ PROP_WIDGET,
+ "main-widget");
g_type_class_add_private (g_object_class, sizeof (EvSidebarLinksPrivate));
}
return _("Index");
}
-GtkWidget *
-ev_sidebar_links_get_treeview (EvSidebarLinks *sidebar)
-{
- return sidebar->priv->tree_view;
-}
-
static void
ev_sidebar_links_page_iface_init (EvSidebarPageIface *iface)
{
GType ev_sidebar_links_get_type (void);
GtkWidget *ev_sidebar_links_new (void);
-GtkWidget *ev_sidebar_links_get_treeview (EvSidebarLinks *sidebar);
G_END_DECLS
#endif
#include "ev-sidebar-page.h"
+#include <gtk/gtk.h>
+
+static void ev_sidebar_page_iface_init (gpointer iface);
GType
ev_sidebar_page_get_type (void)
{
static const GTypeInfo sidebar_page_info =
{
- sizeof (EvDocumentIface),
+ sizeof (EvSidebarPageIface),
NULL,
NULL,
- NULL
+ (GClassInitFunc)ev_sidebar_page_iface_init,
};
type = g_type_register_static (G_TYPE_INTERFACE,
return iface->get_label (sidebar_page);
}
+
+static void ev_sidebar_page_iface_init (gpointer iface)
+{
+ g_object_interface_install_property (iface,
+ g_param_spec_object ("main-widget",
+ "Main Widget",
+ "Main page widget, used to handle focus",
+ GTK_TYPE_WIDGET,
+ G_PARAM_READABLE));
+}
EvDocument *document);
void (* set_document) (EvSidebarPage *sidebar_page,
EvDocument *document);
- const gchar* (* get_label) (EvSidebarPage *sidebar_page);
+ const gchar*(* get_label) (EvSidebarPage *sidebar_page);
};
GType ev_sidebar_page_get_type (void);
NUM_COLUMNS
};
+enum {
+ PROP_0,
+ PROP_WIDGET,
+};
+
static void ev_sidebar_thumbnails_clear_model (EvSidebarThumbnails *sidebar);
static gboolean ev_sidebar_thumbnails_support_document (EvSidebarPage *sidebar_page,
EvDocument *document);
G_OBJECT_CLASS (ev_sidebar_thumbnails_parent_class)->dispose (object);
}
+static void
+ev_sidebar_thumbnails_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EvSidebarThumbnails *sidebar = EV_SIDEBAR_THUMBNAILS (object);
+
+ switch (prop_id)
+ {
+ case PROP_WIDGET:
+ if (sidebar->priv->tree_view)
+ g_value_set_object (value, sidebar->priv->tree_view);
+ else
+ g_value_set_object (value, sidebar->priv->icon_view);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
static void
ev_sidebar_thumbnails_class_init (EvSidebarThumbnailsClass *ev_sidebar_thumbnails_class)
{
gtk_object_class = GTK_OBJECT_CLASS (ev_sidebar_thumbnails_class);
g_object_class->dispose = ev_sidebar_thumbnails_dispose;
+ g_object_class->get_property = ev_sidebar_thumbnails_get_property;
+
+ g_object_class_override_property (g_object_class,
+ PROP_WIDGET,
+ "main-widget");
g_type_class_add_private (g_object_class, sizeof (EvSidebarThumbnailsPrivate));
}
ev_page_cache_set_current_page (page_cache, page);
}
-GtkWidget *
-ev_sidebar_thumbnails_get_treeview (EvSidebarThumbnails *sidebar)
-{
- if (sidebar->priv->tree_view)
- return sidebar->priv->tree_view;
- else
- return sidebar->priv->icon_view;
-}
-
-
static void
ev_sidebar_init_tree_view (EvSidebarThumbnails *ev_sidebar_thumbnails)
{
priv->tree_view = NULL;
}
- if (! priv->icon_view)
+ if (! priv->icon_view) {
ev_sidebar_init_icon_view (sidebar_thumbnails);
+ g_object_notify (G_OBJECT (sidebar_thumbnails), "main_widget");
+ }
} else {
if (priv->icon_view) {
gtk_container_remove (GTK_CONTAINER (priv->swindow), priv->icon_view);
priv->icon_view = NULL;
}
- if (! priv->tree_view)
+ if (! priv->tree_view) {
ev_sidebar_init_tree_view (sidebar_thumbnails);
+ g_object_notify (G_OBJECT (sidebar_thumbnails), "main_widget");
+ }
}
-
/* Connect to the signal and trigger a fake callback */
g_signal_connect (page_cache, "page-changed", G_CALLBACK (page_changed_cb), sidebar_thumbnails);
adjustment_changed_cb (sidebar_thumbnails);
GType ev_sidebar_thumbnails_get_type (void);
GtkWidget *ev_sidebar_thumbnails_new (void);
-GtkWidget *ev_sidebar_thumbnails_get_treeview (EvSidebarThumbnails *sidebar);
G_END_DECLS
{
EvView *view = EV_VIEW (widget);
+ if (!view->document)
+ return FALSE;
+
if (view->pressed_button == 1) {
GdkRectangle selection;
return TRUE;
}
- } else if (view->pressed_button <= 0 && view->document) {
+ } else if (view->pressed_button <= 0) {
EvLink *link;
link = get_link_at_location (view, event->x + view->scroll_x, event->y + view->scroll_y);
#include "ev-job-queue.h"
#include "ev-jobs.h"
#include "ev-statusbar.h"
+#include "ev-sidebar-page.h"
#include "eggfindbar.h"
#include "egg-recent-view-gtk.h"
#include "egg-recent-view.h"
EV_CHROME_SIDEBAR = 1 << 2,
EV_CHROME_FINDBAR = 1 << 3,
EV_CHROME_STATUSBAR = 1 << 4,
+ EV_CHROME_RAISE_TOOLBAR = 1 << 5,
EV_CHROME_NORMAL = EV_CHROME_MENUBAR | EV_CHROME_TOOLBAR | EV_CHROME_SIDEBAR | EV_CHROME_STATUSBAR
} EvChrome;
fullscreen_mode = fullscreen || presentation;
menubar = (priv->chrome & EV_CHROME_MENUBAR) != 0 && !fullscreen_mode;
- toolbar = (priv->chrome & EV_CHROME_TOOLBAR) != 0 && !fullscreen_mode;
+ toolbar = ((priv->chrome & EV_CHROME_TOOLBAR) != 0 ||
+ (priv->chrome & EV_CHROME_RAISE_TOOLBAR) != 0) && !fullscreen_mode;
sidebar = (priv->chrome & EV_CHROME_SIDEBAR) != 0 && !fullscreen_mode;
- fullscreen_toolbar = (priv->chrome & EV_CHROME_TOOLBAR) != 0;
+ fullscreen_toolbar = ((priv->chrome & EV_CHROME_TOOLBAR) != 0 ||
+ (priv->chrome & EV_CHROME_RAISE_TOOLBAR) != 0);
statusbar = (priv->chrome & EV_CHROME_STATUSBAR) != 0 && !fullscreen_mode;
findbar = (priv->chrome & EV_CHROME_FINDBAR) != 0;
{
GtkAction *action;
+ update_chrome_flag (window, EV_CHROME_RAISE_TOOLBAR, NULL, TRUE);
+ set_action_sensitive (window, "ViewToolbar", FALSE);
+
action = gtk_action_group_get_action (window->priv->action_group,
PAGE_SELECTOR_ACTION);
ev_page_action_grab_focus (EV_PAGE_ACTION (action));
g_return_if_fail (popup != NULL);
- toolbar = (window->priv->chrome & EV_CHROME_TOOLBAR) != 0;
+ toolbar = (window->priv->chrome & EV_CHROME_TOOLBAR) != 0 ||
+ (window->priv->chrome & EV_CHROME_RAISE_TOOLBAR) != 0;
popup_width = popup->requisition.width;
popup_height = popup->requisition.height;
static void
view_actions_focus_in_cb (GtkWidget *widget, GdkEventFocus *event, EvWindow *window)
{
+ update_chrome_flag (window, EV_CHROME_RAISE_TOOLBAR, NULL, FALSE);
+ set_action_sensitive (window, "ViewToolbar", TRUE);
+
set_view_actions_sensitivity (window, TRUE);
}
}
static void
-enable_view_actions_for_widget (EvWindow *window, GtkWidget *widget)
+sidebar_page_main_widget_update_cb (GObject *ev_sidebar_page,
+ GParamSpec *pspec,
+ EvWindow *ev_window)
{
+ GtkWidget *widget;
+
+ g_object_get (ev_sidebar_page, "main_widget", &widget, NULL);
+
+ if (widget != NULL) {
g_signal_connect_object (widget, "focus_in_event",
G_CALLBACK (view_actions_focus_in_cb),
- window, 0);
+ ev_window, 0);
g_signal_connect_object (widget, "focus_out_event",
G_CALLBACK (view_actions_focus_out_cb),
- window, 0);
+ ev_window, 0);
+ }
}
static void
GtkActionGroup *action_group;
GtkAccelGroup *accel_group;
GError *error = NULL;
- GtkWidget *sidebar_widget, *toolbar_dock, *tree_view;
+ GtkWidget *sidebar_widget, *toolbar_dock;
GConfValue *value;
GConfClient *client;
int sidebar_size;
"notify::model",
G_CALLBACK (sidebar_widget_model_set),
ev_window);
- tree_view = ev_sidebar_links_get_treeview
- (EV_SIDEBAR_LINKS (sidebar_widget));
- enable_view_actions_for_widget (ev_window, tree_view);
+ sidebar_page_main_widget_update_cb (G_OBJECT (sidebar_widget), NULL, ev_window);
gtk_widget_show (sidebar_widget);
ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar),
sidebar_widget);
sidebar_widget = ev_sidebar_thumbnails_new ();
- tree_view = ev_sidebar_thumbnails_get_treeview
- (EV_SIDEBAR_THUMBNAILS (sidebar_widget));
- //enable_view_actions_for_widget (ev_window, tree_view);
+ g_signal_connect (sidebar_widget,
+ "notify::main-widget",
+ G_CALLBACK (sidebar_page_main_widget_update_cb),
+ ev_window);
+ sidebar_page_main_widget_update_cb (G_OBJECT (sidebar_widget), NULL, ev_window);
gtk_widget_show (sidebar_widget);
ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar),
sidebar_widget);
+
ev_window->priv->scrolled_window =
GTK_WIDGET (g_object_new (GTK_TYPE_SCROLLED_WINDOW,
"shadow-type", GTK_SHADOW_IN,
"unlock",
G_CALLBACK (ev_window_popup_password_dialog),
ev_window);
- enable_view_actions_for_widget (ev_window, ev_window->priv->view);
+ g_signal_connect_object (ev_window->priv->view, "focus_in_event",
+ G_CALLBACK (view_actions_focus_in_cb),
+ ev_window, 0);
+ g_signal_connect_object (ev_window->priv->view, "focus_out_event",
+ G_CALLBACK (view_actions_focus_out_cb),
+ ev_window, 0);
gtk_widget_show (ev_window->priv->view);
gtk_widget_show (ev_window->priv->password_view);
+
/* We own a ref on these widgets, as we can swap them in and out */
g_object_ref (ev_window->priv->view);
//g_object_ref (ev_window->priv->page_view);