Skip to content

Commit

Permalink
[shell] Fix build with GSEAL_ENABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Garcia Campos committed Mar 31, 2010
1 parent 7e11393 commit 80aa207
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 47 deletions.
2 changes: 1 addition & 1 deletion shell/eggfindbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ set_focus_cb (GtkWidget *window,

while (widget != NULL && widget != wbar)
{
widget = widget->parent;
widget = gtk_widget_get_parent (widget);
}

/* if widget == bar, the new focus widget is in the bar, so we
Expand Down
19 changes: 15 additions & 4 deletions shell/ev-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,10 @@ ev_application_open_uri_in_window (EvApplication *application,
const gchar *search_string,
guint timestamp)
{
#ifdef GDK_WINDOWING_X11
GdkWindow *gdk_window;
#endif

if (screen) {
ev_stock_icons_set_screen (screen);
gtk_window_set_screen (GTK_WINDOW (ev_window), screen);
Expand All @@ -623,9 +627,11 @@ ev_application_open_uri_in_window (EvApplication *application,
gtk_widget_realize (GTK_WIDGET (ev_window));

#ifdef GDK_WINDOWING_X11
gdk_window = gtk_widget_get_window (GTK_WIDGET (ev_window));

if (timestamp <= 0)
timestamp = gdk_x11_get_server_time (GTK_WIDGET (ev_window)->window);
gdk_x11_window_set_user_time (GTK_WIDGET (ev_window)->window, timestamp);
timestamp = gdk_x11_get_server_time (gdk_window);
gdk_x11_window_set_user_time (gdk_window, timestamp);

ev_document_fc_mutex_lock ();
gtk_window_present (GTK_WINDOW (ev_window));
Expand Down Expand Up @@ -703,6 +709,9 @@ ev_application_open_window (EvApplication *application,
guint32 timestamp)
{
GtkWidget *new_window = ev_window_new ();
#ifdef GDK_WINDOWING_X11
GdkWindow *gdk_window;
#endif

if (screen) {
ev_stock_icons_set_screen (screen);
Expand All @@ -713,9 +722,11 @@ ev_application_open_window (EvApplication *application,
gtk_widget_realize (new_window);

#ifdef GDK_WINDOWING_X11
gdk_window = gtk_widget_get_window (GTK_WIDGET (new_window));

if (timestamp <= 0)
timestamp = gdk_x11_get_server_time (new_window->window);
gdk_x11_window_set_user_time (new_window->window, timestamp);
timestamp = gdk_x11_get_server_time (gdk_window);
gdk_x11_window_set_user_time (gdk_window, timestamp);

gtk_window_present (GTK_WINDOW (new_window));
#else
Expand Down
6 changes: 4 additions & 2 deletions shell/ev-convert-metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ static void
show_progress_dialog (ConvertData *data)
{
GtkWidget *dialog;
GtkWidget *action_area;
GtkWidget *vbox, *pbox;
GtkWidget *label;
GtkWidget *progress;
Expand All @@ -166,9 +167,10 @@ show_progress_dialog (ConvertData *data)
GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NULL);
action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6);
gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
gtk_box_set_spacing (GTK_BOX (action_area), 6);

vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_box_set_spacing (GTK_BOX (vbox), 12);
Expand Down
6 changes: 3 additions & 3 deletions shell/ev-message-area.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ ev_message_area_init (EvMessageArea *area)
gtk_label_set_line_wrap (GTK_LABEL (area->priv->label), TRUE);
gtk_label_set_selectable (GTK_LABEL (area->priv->label), TRUE);
gtk_misc_set_alignment (GTK_MISC (area->priv->label), 0.0, 0.5);
GTK_WIDGET_SET_FLAGS (area->priv->label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (area->priv->label, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), area->priv->label, TRUE, TRUE, 0);
gtk_widget_show (area->priv->label);

Expand All @@ -115,7 +115,7 @@ ev_message_area_init (EvMessageArea *area)
gtk_label_set_line_wrap (GTK_LABEL (area->priv->secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (area->priv->secondary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (area->priv->secondary_label), 0.0, 0.5);
GTK_WIDGET_SET_FLAGS (area->priv->secondary_label, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (area->priv->secondary_label, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), area->priv->secondary_label, TRUE, TRUE, 0);

area->priv->image = gtk_image_new_from_stock (NULL, GTK_ICON_SIZE_DIALOG);
Expand Down Expand Up @@ -291,7 +291,7 @@ ev_message_area_set_image (EvMessageArea *area,

area->priv->message_type = GTK_MESSAGE_OTHER;

parent = area->priv->image->parent;
parent = gtk_widget_get_parent (area->priv->image);
gtk_container_add (GTK_CONTAINER (parent), image);
gtk_container_remove (GTK_CONTAINER (parent), area->priv->image);
gtk_box_reorder_child (GTK_BOX (parent), image, 0);
Expand Down
26 changes: 15 additions & 11 deletions shell/ev-navigation-action-widget.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ menu_position_func (GtkMenu *menu,
{
GtkWidget *widget = GTK_WIDGET (button);
GtkRequisition menu_req;
GtkAllocation allocation;
GtkTextDirection direction;
GdkWindow *gdk_window;
GdkRectangle monitor;
gint monitor_num;
GdkScreen *screen;
Expand All @@ -136,26 +138,28 @@ menu_position_func (GtkMenu *menu,
direction = gtk_widget_get_direction (widget);
screen = gtk_widget_get_screen (GTK_WIDGET (menu));

monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window);
gdk_window = gtk_widget_get_window (widget);
monitor_num = gdk_screen_get_monitor_at_window (screen, gdk_window);
if (monitor_num < 0)
monitor_num = 0;
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);

gdk_window_get_origin (widget->window, x, y);
*x += widget->allocation.x;
*y += widget->allocation.y;
gdk_window_get_origin (gdk_window, x, y);
gtk_widget_get_allocation (widget, &allocation);
*x += allocation.x;
*y += allocation.y;

if (direction == GTK_TEXT_DIR_LTR)
*x += MAX (widget->allocation.width - menu_req.width, 0);
else if (menu_req.width > widget->allocation.width)
*x -= menu_req.width - widget->allocation.width;
*x += MAX (allocation.width - menu_req.width, 0);
else if (menu_req.width > allocation.width)
*x -= menu_req.width - allocation.width;

if ((*y + widget->allocation.height + menu_req.height) <= monitor.y + monitor.height)
*y += widget->allocation.height;
if ((*y + allocation.height + menu_req.height) <= monitor.y + monitor.height)
*y += allocation.height;
else if ((*y - menu_req.height) >= monitor.y)
*y -= menu_req.height;
else if (monitor.y + monitor.height - (*y + widget->allocation.height) > *y)
*y += widget->allocation.height;
else if (monitor.y + monitor.height - (*y + allocation.height) > *y)
*y += allocation.height;
else
*y -= menu_req.height;

Expand Down
4 changes: 2 additions & 2 deletions shell/ev-navigation-action.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ new_history_menu_item (EvNavigationAction *action,

title = ev_link_get_title (link);
item = gtk_image_menu_item_new_with_label (title);
gtk_label_set_use_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), TRUE);
label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (item)));
gtk_label_set_use_markup (label, TRUE);
g_object_set_data (G_OBJECT (item), "index",
GINT_TO_POINTER (index));

label = GTK_LABEL (GTK_BIN (item)->child);
gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END);
gtk_label_set_max_width_chars (label, MAX_LABEL_LENGTH);

Expand Down
13 changes: 8 additions & 5 deletions shell/ev-password-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ void
ev_password_view_ask_password (EvPasswordView *password_view)
{
GtkDialog *dialog;
GtkWidget *content_area, *action_area;
GtkWidget *entry_container;
GtkWidget *hbox, *main_vbox, *vbox, *icon;
GtkWidget *table;
Expand All @@ -250,13 +251,15 @@ ev_password_view_ask_password (EvPasswordView *password_view)
gtk_widget_set_sensitive (GTK_WIDGET (password_view), FALSE);

dialog = GTK_DIALOG (gtk_dialog_new ());

content_area = gtk_dialog_get_content_area (dialog);
action_area = gtk_dialog_get_action_area (dialog);

/* Set the dialog up with HIG properties */
gtk_dialog_set_has_separator (dialog, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
gtk_box_set_spacing (GTK_BOX (action_area), 6);

gtk_window_set_title (GTK_WINDOW (dialog), _("Enter password"));
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
Expand All @@ -279,7 +282,7 @@ ev_password_view_ask_password (EvPasswordView *password_view)
/* Build contents */
hbox = gtk_hbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
gtk_box_pack_start (GTK_BOX (dialog->vbox), hbox, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);

icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION,
Expand Down
9 changes: 6 additions & 3 deletions shell/ev-properties-dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,15 @@ ev_properties_dialog_class_init (EvPropertiesDialogClass *properties_class)
static void
ev_properties_dialog_init (EvPropertiesDialog *properties)
{
GtkBox *content_area;

content_area = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (properties)));

gtk_window_set_title (GTK_WINDOW (properties), _("Properties"));
gtk_window_set_destroy_with_parent (GTK_WINDOW (properties), TRUE);
gtk_dialog_set_has_separator (GTK_DIALOG (properties), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (properties), 5);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (properties)->vbox), 2);
gtk_box_set_spacing (content_area, 2);

gtk_dialog_add_button (GTK_DIALOG (properties), GTK_STOCK_CLOSE,
GTK_RESPONSE_CANCEL);
Expand All @@ -68,8 +72,7 @@ ev_properties_dialog_init (EvPropertiesDialog *properties)

properties->notebook = gtk_notebook_new ();
gtk_container_set_border_width (GTK_CONTAINER (properties->notebook), 5);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (properties)->vbox),
properties->notebook, TRUE, TRUE, 0);
gtk_box_pack_start (content_area, properties->notebook, TRUE, TRUE, 0);
gtk_widget_show (properties->notebook);

g_signal_connect (properties, "response",
Expand Down
2 changes: 1 addition & 1 deletion shell/ev-sidebar-links.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ build_popup_menu (EvSidebarLinks *sidebar)

menu = gtk_menu_new ();
item = gtk_image_menu_item_new_from_stock (GTK_STOCK_PRINT, NULL);
gtk_label_set_label (GTK_LABEL (GTK_BIN (item)->child), _("Print…"));
gtk_label_set_label (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), _("Print…"));
gtk_widget_show (item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
g_signal_connect (item, "activate",
Expand Down
12 changes: 9 additions & 3 deletions shell/ev-sidebar-thumbnails.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,25 +499,31 @@ adjustment_changed_cb (EvSidebarThumbnails *sidebar_thumbnails)
EvSidebarThumbnailsPrivate *priv = sidebar_thumbnails->priv;
GtkTreePath *path = NULL;
GtkTreePath *path2 = NULL;
gdouble page_size;
gdouble value;
gint wy1;
gint wy2;

/* Widget is not currently visible */
if (!gtk_widget_get_mapped (GTK_WIDGET (sidebar_thumbnails)))
return;

if (priv->vadjustment->page_size == 0)
page_size = gtk_adjustment_get_page_size (priv->vadjustment);

if (page_size == 0)
return;

value = gtk_adjustment_get_value (priv->vadjustment);

if (priv->tree_view) {
if (! gtk_widget_get_realized (priv->tree_view))
return;

gtk_tree_view_convert_tree_to_bin_window_coords (GTK_TREE_VIEW (priv->tree_view),
0, (int) priv->vadjustment->value,
0, (int) value,
NULL, &wy1);
gtk_tree_view_convert_tree_to_bin_window_coords (GTK_TREE_VIEW (priv->tree_view),
0, (int) (priv->vadjustment->value + priv->vadjustment->page_size),
0, (int) (value + page_size),
NULL, &wy2);
gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (priv->tree_view),
1, wy1 + 1, &path,
Expand Down
16 changes: 10 additions & 6 deletions shell/ev-sidebar.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,19 @@ ev_sidebar_menu_position_under (GtkMenu *menu,
gboolean *push_in,
gpointer user_data)
{
GtkWidget *widget;
GtkWidget *widget;
GtkAllocation allocation;

g_return_if_fail (GTK_IS_BUTTON (user_data));
g_return_if_fail (!gtk_widget_get_has_window (GTK_WIDGET (user_data)));

widget = GTK_WIDGET (user_data);

gdk_window_get_origin (widget->window, x, y);
gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
gtk_widget_get_allocation (widget, &allocation);

*x += widget->allocation.x;
*y += widget->allocation.y + widget->allocation.height;
*x += allocation.x;
*y += allocation.y + allocation.height;

*push_in = FALSE;
}
Expand All @@ -229,9 +231,11 @@ ev_sidebar_select_button_press_cb (GtkWidget *widget,

if (event->button == 1) {
GtkRequisition requisition;
GtkAllocation allocation;
gint width;

width = widget->allocation.width;

gtk_widget_get_allocation (widget, &allocation);
width = allocation.width;
gtk_widget_set_size_request (ev_sidebar->priv->menu, -1, -1);
gtk_widget_size_request (ev_sidebar->priv->menu, &requisition);
gtk_widget_set_size_request (ev_sidebar->priv->menu,
Expand Down
8 changes: 5 additions & 3 deletions shell/ev-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,18 @@ ev_gui_menu_position_tree_selection (GtkMenu *menu,
GtkTreeView *tree_view = GTK_TREE_VIEW (user_data);
GtkWidget *widget = GTK_WIDGET (user_data);
GtkRequisition req;
GtkAllocation allocation;
GdkRectangle visible;

gtk_widget_size_request (GTK_WIDGET (menu), &req);
gdk_window_get_origin (widget->window, x, y);
gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
gtk_widget_get_allocation (widget, &allocation);

*x += (widget->allocation.width - req.width) / 2;
*x += (allocation.width - req.width) / 2;

/* Add on height for the treeview title */
gtk_tree_view_get_visible_rect (tree_view, &visible);
*y += widget->allocation.height - visible.height;
*y += allocation.height - visible.height;

selection = gtk_tree_view_get_selection (tree_view);
selected_rows = gtk_tree_selection_get_selected_rows (selection, &model);
Expand Down
8 changes: 5 additions & 3 deletions shell/ev-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -3813,6 +3813,7 @@ ev_window_cmd_edit_toolbar (GtkAction *action, EvWindow *ev_window)
{
GtkWidget *dialog;
GtkWidget *editor;
GtkWidget *content_area;
EggEditableToolbar *toolbar;

dialog = gtk_dialog_new_with_buttons (_("Toolbar Editor"),
Expand All @@ -3821,9 +3822,10 @@ ev_window_cmd_edit_toolbar (GtkAction *action, EvWindow *ev_window)
GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE,
NULL);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)), 5);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
gtk_box_set_spacing (GTK_BOX (content_area), 2);
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 400);

Expand All @@ -3834,7 +3836,7 @@ ev_window_cmd_edit_toolbar (GtkAction *action, EvWindow *ev_window)
gtk_container_set_border_width (GTK_CONTAINER (editor), 5);
gtk_box_set_spacing (GTK_BOX (EGG_TOOLBAR_EDITOR (editor)), 5);

gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), editor);
gtk_container_add (GTK_CONTAINER (content_area), editor);

egg_editable_toolbar_set_edit_mode (toolbar, TRUE);

Expand Down Expand Up @@ -5410,7 +5412,7 @@ window_configure_event_cb (EvWindow *window, GdkEventConfigure *event, gpointer
if (!window->priv->metadata)
return FALSE;

state = gdk_window_get_state (GTK_WIDGET (window)->window);
state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window)));

if (!(state & GDK_WINDOW_STATE_FULLSCREEN)) {
if (!ev_window_is_empty (window) && window->priv->document) {
Expand Down

0 comments on commit 80aa207

Please sign in to comment.