Use accessor functions instead direct access
https://bugzilla.gnome.org/show_bug.cgi?id=597888
This commit is contained in:
parent
133fce3ac2
commit
c2211ffe0b
23 changed files with 312 additions and 301 deletions
|
@ -328,22 +328,22 @@ image_drag_data_received_cb (GtkWidget *widget,
|
||||||
GtkSelectionData *selection_data,
|
GtkSelectionData *selection_data,
|
||||||
guint info, guint time, EImageChooser *chooser)
|
guint info, guint time, EImageChooser *chooser)
|
||||||
{
|
{
|
||||||
|
|
||||||
char *target_type;
|
char *target_type;
|
||||||
gboolean handled = FALSE;
|
gboolean handled = FALSE;
|
||||||
|
|
||||||
target_type = gdk_atom_name (selection_data->target);
|
target_type = gdk_atom_name (gtk_selection_data_get_target (selection_data));
|
||||||
|
|
||||||
if (!strcmp (target_type, URI_LIST_TYPE)) {
|
if (!strcmp (target_type, URI_LIST_TYPE)) {
|
||||||
|
const char *data = gtk_selection_data_get_data (selection_data);
|
||||||
char *uri;
|
char *uri;
|
||||||
GFile *file;
|
GFile *file;
|
||||||
GInputStream *istream;
|
GInputStream *istream;
|
||||||
char *nl = strstr (selection_data->data, "\r\n");
|
char *nl = strstr (data, "\r\n");
|
||||||
|
|
||||||
if (nl)
|
if (nl)
|
||||||
uri = g_strndup (selection_data->data, nl - (char *) selection_data->data);
|
uri = g_strndup (data, nl - (char *) data);
|
||||||
else
|
else
|
||||||
uri = g_strdup (selection_data->data);
|
uri = g_strdup (data);
|
||||||
|
|
||||||
file = g_file_new_for_uri (uri);
|
file = g_file_new_for_uri (uri);
|
||||||
istream = G_INPUT_STREAM (g_file_read (file, NULL, NULL));
|
istream = G_INPUT_STREAM (g_file_read (file, NULL, NULL));
|
||||||
|
|
|
@ -200,7 +200,7 @@ eel_alert_dialog_init (EelAlertDialog *dialog)
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox,
|
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox,
|
||||||
FALSE, FALSE, 0);
|
FALSE, FALSE, 0);
|
||||||
|
|
||||||
gtk_widget_show_all (hbox);
|
gtk_widget_show_all (hbox);
|
||||||
|
@ -354,7 +354,7 @@ eel_alert_dialog_new (GtkWindow *parent,
|
||||||
dialog = GTK_DIALOG (widget);
|
dialog = GTK_DIALOG (widget);
|
||||||
|
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
|
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
|
||||||
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
|
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 14);
|
||||||
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
|
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
|
||||||
gtk_dialog_set_has_separator (dialog, FALSE);
|
gtk_dialog_set_has_separator (dialog, FALSE);
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ eel_alert_dialog_style_set (GtkWidget *widget,
|
||||||
|
|
||||||
border_width = 0;
|
border_width = 0;
|
||||||
|
|
||||||
parent = GTK_WIDGET (EEL_ALERT_DIALOG (widget)->details->image->parent);
|
parent = gtk_widget_get_parent (EEL_ALERT_DIALOG (widget)->details->image);
|
||||||
|
|
||||||
if (parent != NULL) {
|
if (parent != NULL) {
|
||||||
gtk_widget_style_get (widget, "alert_border",
|
gtk_widget_style_get (widget, "alert_border",
|
||||||
|
|
|
@ -220,7 +220,7 @@ delete_fingerprints_question (GtkBuilder *dialog, GtkWidget *enable, GtkWidget *
|
||||||
|
|
||||||
button = gtk_button_new_with_mnemonic (_("_Delete Fingerprints"));
|
button = gtk_button_new_with_mnemonic (_("_Delete Fingerprints"));
|
||||||
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON));
|
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON));
|
||||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
gtk_widget_set_can_default (button, TRUE);
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
gtk_dialog_add_action_widget (GTK_DIALOG (question), button, GTK_RESPONSE_OK);
|
gtk_dialog_add_action_widget (GTK_DIALOG (question), button, GTK_RESPONSE_OK);
|
||||||
|
|
||||||
|
|
|
@ -678,7 +678,7 @@ passdlg_set_busy (PasswordDialog *pdialog, gboolean busy)
|
||||||
cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
|
cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_window_set_cursor (toplevel->window, cursor);
|
gdk_window_set_cursor (gtk_widget_get_window (toplevel), cursor);
|
||||||
gdk_display_flush (display);
|
gdk_display_flush (display);
|
||||||
|
|
||||||
if (busy) {
|
if (busy) {
|
||||||
|
|
|
@ -707,7 +707,7 @@ wp_drag_received (GtkWidget *widget,
|
||||||
GSList *realuris = NULL;
|
GSList *realuris = NULL;
|
||||||
gchar **uris;
|
gchar **uris;
|
||||||
|
|
||||||
uris = g_uri_list_extract_uris ((gchar *) selection_data->data);
|
uris = g_uri_list_extract_uris ((gchar *) gtk_selection_data_get_data (selection_data));
|
||||||
if (uris != NULL)
|
if (uris != NULL)
|
||||||
{
|
{
|
||||||
GtkWidget *w;
|
GtkWidget *w;
|
||||||
|
@ -1051,20 +1051,21 @@ static void
|
||||||
create_button_images (AppearanceData *data)
|
create_button_images (AppearanceData *data)
|
||||||
{
|
{
|
||||||
GtkWidget *widget = (GtkWidget*)data->wp_view;
|
GtkWidget *widget = (GtkWidget*)data->wp_view;
|
||||||
|
GtkStyle *style = gtk_widget_get_style (widget);
|
||||||
GtkIconSet *icon_set;
|
GtkIconSet *icon_set;
|
||||||
GdkPixbuf *pixbuf, *pb, *pb2;
|
GdkPixbuf *pixbuf, *pb, *pb2;
|
||||||
gint i, w, h;
|
gint i, w, h;
|
||||||
|
|
||||||
icon_set = gtk_style_lookup_icon_set (widget->style, "gtk-media-play");
|
icon_set = gtk_style_lookup_icon_set (style, "gtk-media-play");
|
||||||
pb = gtk_icon_set_render_icon (icon_set,
|
pb = gtk_icon_set_render_icon (icon_set,
|
||||||
widget->style,
|
style,
|
||||||
GTK_TEXT_DIR_RTL,
|
GTK_TEXT_DIR_RTL,
|
||||||
GTK_STATE_NORMAL,
|
GTK_STATE_NORMAL,
|
||||||
GTK_ICON_SIZE_MENU,
|
GTK_ICON_SIZE_MENU,
|
||||||
widget,
|
widget,
|
||||||
NULL);
|
NULL);
|
||||||
pb2 = gtk_icon_set_render_icon (icon_set,
|
pb2 = gtk_icon_set_render_icon (icon_set,
|
||||||
widget->style,
|
style,
|
||||||
GTK_TEXT_DIR_LTR,
|
GTK_TEXT_DIR_LTR,
|
||||||
GTK_STATE_NORMAL,
|
GTK_STATE_NORMAL,
|
||||||
GTK_ICON_SIZE_MENU,
|
GTK_ICON_SIZE_MENU,
|
||||||
|
|
|
@ -91,21 +91,26 @@ static void
|
||||||
sample_expose (GtkWidget *darea,
|
sample_expose (GtkWidget *darea,
|
||||||
GdkEventExpose *expose)
|
GdkEventExpose *expose)
|
||||||
{
|
{
|
||||||
|
GtkAllocation allocation;
|
||||||
GdkPixbuf *pixbuf = g_object_get_data (G_OBJECT (darea), "sample-pixbuf");
|
GdkPixbuf *pixbuf = g_object_get_data (G_OBJECT (darea), "sample-pixbuf");
|
||||||
|
GdkWindow *window = gtk_widget_get_window (darea);
|
||||||
|
GtkStyle *style = gtk_widget_get_style (darea);
|
||||||
int width = gdk_pixbuf_get_width (pixbuf);
|
int width = gdk_pixbuf_get_width (pixbuf);
|
||||||
int height = gdk_pixbuf_get_height (pixbuf);
|
int height = gdk_pixbuf_get_height (pixbuf);
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
|
||||||
int x = (darea->allocation.width - width) / 2;
|
gtk_widget_get_allocation (darea, &allocation);
|
||||||
int y = (darea->allocation.height - height) / 2;
|
x = (allocation.width - width) / 2;
|
||||||
|
y = (allocation.height - height) / 2;
|
||||||
gdk_draw_rectangle (darea->window, darea->style->white_gc, TRUE,
|
gdk_draw_rectangle (window, style->white_gc, TRUE,
|
||||||
0, 0,
|
0, 0,
|
||||||
darea->allocation.width, darea->allocation.height);
|
allocation.width, allocation.height);
|
||||||
gdk_draw_rectangle (darea->window, darea->style->black_gc, FALSE,
|
gdk_draw_rectangle (window, style->black_gc, FALSE,
|
||||||
0, 0,
|
0, 0,
|
||||||
darea->allocation.width - 1, darea->allocation.height - 1);
|
allocation.width - 1, allocation.height - 1);
|
||||||
|
|
||||||
gdk_draw_pixbuf (darea->window, NULL, pixbuf, 0, 0, x, y, width, height,
|
gdk_draw_pixbuf (window, NULL, pixbuf, 0, 0, x, y, width, height,
|
||||||
GDK_RGB_DITHER_NORMAL, 0, 0);
|
GDK_RGB_DITHER_NORMAL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +542,7 @@ application_font_to_gconf (GConfPropertyEditor *peditor,
|
||||||
|
|
||||||
gtk_button_set_image (GTK_BUTTON (apply_button), gtk_image_new_from_stock (GTK_STOCK_APPLY, GTK_ICON_SIZE_BUTTON));
|
gtk_button_set_image (GTK_BUTTON (apply_button), gtk_image_new_from_stock (GTK_STOCK_APPLY, GTK_ICON_SIZE_BUTTON));
|
||||||
gtk_dialog_add_action_widget (GTK_DIALOG (warning_dialog), apply_button, GTK_RESPONSE_APPLY);
|
gtk_dialog_add_action_widget (GTK_DIALOG (warning_dialog), apply_button, GTK_RESPONSE_APPLY);
|
||||||
GTK_WIDGET_SET_FLAGS (apply_button, GTK_CAN_DEFAULT);
|
gtk_widget_set_can_default (apply_button, TRUE);
|
||||||
gtk_widget_show (apply_button);
|
gtk_widget_show (apply_button);
|
||||||
|
|
||||||
gtk_dialog_set_default_response (GTK_DIALOG (warning_dialog), GTK_RESPONSE_CLOSE);
|
gtk_dialog_set_default_response (GTK_DIALOG (warning_dialog), GTK_RESPONSE_CLOSE);
|
||||||
|
@ -829,9 +834,9 @@ cb_show_details (GtkWidget *button,
|
||||||
|
|
||||||
/* pick a sensible maximum dpi */
|
/* pick a sensible maximum dpi */
|
||||||
adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
|
adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
|
||||||
adjustment->upper = DPI_HIGH_REASONABLE_VALUE;
|
gtk_adjustment_set_lower (adjustment, DPI_LOW_REASONABLE_VALUE);
|
||||||
adjustment->lower = DPI_LOW_REASONABLE_VALUE;
|
gtk_adjustment_set_upper (adjustment, DPI_HIGH_REASONABLE_VALUE);
|
||||||
adjustment->step_increment = 1;
|
gtk_adjustment_set_step_increment (adjustment, 1);
|
||||||
|
|
||||||
dpi_load (data->client, GTK_SPIN_BUTTON (widget));
|
dpi_load (data->client, GTK_SPIN_BUTTON (widget));
|
||||||
g_signal_connect (widget, "value_changed",
|
g_signal_connect (widget, "value_changed",
|
||||||
|
|
|
@ -984,7 +984,7 @@ theme_drag_data_received_cb (GtkWidget *widget,
|
||||||
if (!(info == TARGET_URI_LIST || info == TARGET_NS_URL))
|
if (!(info == TARGET_URI_LIST || info == TARGET_NS_URL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uris = g_uri_list_extract_uris ((gchar *) selection_data->data);
|
uris = g_uri_list_extract_uris ((gchar *) gtk_selection_data_get_data (selection_data));
|
||||||
|
|
||||||
if (uris != NULL && uris[0] != NULL) {
|
if (uris != NULL && uris[0] != NULL) {
|
||||||
GFile *f = g_file_new_for_uri (uris[0]);
|
GFile *f = g_file_new_for_uri (uris[0]);
|
||||||
|
|
|
@ -429,7 +429,7 @@ gnome_theme_install_real (GtkWindow *parent,
|
||||||
gtk_image_new_from_stock (GTK_STOCK_APPLY,
|
gtk_image_new_from_stock (GTK_STOCK_APPLY,
|
||||||
GTK_ICON_SIZE_BUTTON));
|
GTK_ICON_SIZE_BUTTON));
|
||||||
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), apply_button, GTK_RESPONSE_APPLY);
|
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), apply_button, GTK_RESPONSE_APPLY);
|
||||||
GTK_WIDGET_SET_FLAGS (apply_button, GTK_CAN_DEFAULT);
|
gtk_widget_set_can_default (apply_button, TRUE);
|
||||||
gtk_widget_show (apply_button);
|
gtk_widget_show (apply_button);
|
||||||
|
|
||||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY);
|
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY);
|
||||||
|
|
|
@ -294,19 +294,20 @@ file_transfer_dialog_init (FileTransferDialog *dlg)
|
||||||
GtkWidget *progress_vbox;
|
GtkWidget *progress_vbox;
|
||||||
GtkWidget *table;
|
GtkWidget *table;
|
||||||
char *markup;
|
char *markup;
|
||||||
|
GtkWidget *content_area;
|
||||||
|
|
||||||
|
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dlg));
|
||||||
dlg->priv = FILE_TRANSFER_DIALOG_GET_PRIVATE (dlg);
|
dlg->priv = FILE_TRANSFER_DIALOG_GET_PRIVATE (dlg);
|
||||||
dlg->priv->cancellable = g_cancellable_new ();
|
dlg->priv->cancellable = g_cancellable_new ();
|
||||||
|
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dlg)->vbox),
|
gtk_container_set_border_width (GTK_CONTAINER (content_area), 4);
|
||||||
4);
|
gtk_box_set_spacing (GTK_BOX (content_area), 4);
|
||||||
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dlg)->vbox), 4);
|
|
||||||
|
|
||||||
gtk_widget_set_size_request (GTK_WIDGET (dlg), 350, -1);
|
gtk_widget_set_size_request (GTK_WIDGET (dlg), 350, -1);
|
||||||
|
|
||||||
vbox = gtk_vbox_new (FALSE, 6);
|
vbox = gtk_vbox_new (FALSE, 6);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
||||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
|
||||||
|
|
||||||
dlg->priv->status = gtk_label_new (NULL);
|
dlg->priv->status = gtk_label_new (NULL);
|
||||||
markup = g_strconcat ("<big><b>", _("Copying files"), "</b></big>", NULL);
|
markup = g_strconcat ("<big><b>", _("Copying files"), "</b></big>", NULL);
|
||||||
|
@ -339,7 +340,7 @@ file_transfer_dialog_init (FileTransferDialog *dlg)
|
||||||
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
|
gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (dlg), 6);
|
gtk_container_set_border_width (GTK_CONTAINER (dlg), 6);
|
||||||
|
|
||||||
gtk_widget_show_all (GTK_DIALOG (dlg)->vbox);
|
gtk_widget_show_all (content_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
|
|
|
@ -968,7 +968,7 @@ peditor_select_radio_widget_changed (GConfPropertyEditor *peditor,
|
||||||
GConfValue *value, *value_wid;
|
GConfValue *value, *value_wid;
|
||||||
|
|
||||||
if (!peditor->p->inited) return;
|
if (!peditor->p->inited) return;
|
||||||
if (!tb->active) return;
|
if (!gtk_toggle_button_get_active (tb)) return;
|
||||||
|
|
||||||
value_wid = gconf_value_new (GCONF_VALUE_INT);
|
value_wid = gconf_value_new (GCONF_VALUE_INT);
|
||||||
group = g_slist_copy (gtk_radio_button_get_group (GTK_RADIO_BUTTON (peditor->p->ui_control)));
|
group = g_slist_copy (gtk_radio_button_get_group (GTK_RADIO_BUTTON (peditor->p->ui_control)));
|
||||||
|
@ -1393,6 +1393,7 @@ peditor_image_set_filename (GConfPropertyEditor *peditor, const gchar *filename)
|
||||||
GtkImage *image = NULL;
|
GtkImage *image = NULL;
|
||||||
const int scale = 100;
|
const int scale = 100;
|
||||||
gchar *message = NULL;
|
gchar *message = NULL;
|
||||||
|
GtkWidget *ui_control_child;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
/* NULL is not valid, however "" is, but not an error (it's
|
/* NULL is not valid, however "" is, but not an error (it's
|
||||||
|
@ -1417,11 +1418,13 @@ peditor_image_set_filename (GConfPropertyEditor *peditor, const gchar *filename)
|
||||||
filename);
|
filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GTK_IS_IMAGE (GTK_BIN (peditor->p->ui_control)->child))
|
ui_control_child = gtk_bin_get_child (GTK_BIN (peditor->p->ui_control));
|
||||||
image = GTK_IMAGE (GTK_BIN (peditor->p->ui_control)->child);
|
|
||||||
|
if (GTK_IS_IMAGE (ui_control_child))
|
||||||
|
image = GTK_IMAGE (ui_control_child);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (l = gtk_container_get_children (GTK_CONTAINER (GTK_BIN (peditor->p->ui_control)->child)); l != NULL; l = l->next)
|
for (l = gtk_container_get_children (GTK_CONTAINER (ui_control_child)); l != NULL; l = l->next)
|
||||||
{
|
{
|
||||||
if (GTK_IS_IMAGE (l->data))
|
if (GTK_IS_IMAGE (l->data))
|
||||||
image = GTK_IMAGE (l->data);
|
image = GTK_IMAGE (l->data);
|
||||||
|
|
|
@ -92,38 +92,40 @@ static int pipe_from_factory_fd[2];
|
||||||
#define METACITY_THUMBNAIL_WIDTH 120
|
#define METACITY_THUMBNAIL_WIDTH 120
|
||||||
#define METACITY_THUMBNAIL_HEIGHT 60
|
#define METACITY_THUMBNAIL_HEIGHT 60
|
||||||
|
|
||||||
|
static GdkPixmap*
|
||||||
static void
|
draw_window_on_pixbuf (GtkWidget *widget)
|
||||||
fake_expose_widget (GtkWidget *widget,
|
|
||||||
GdkPixmap *pixmap,
|
|
||||||
GdkRectangle *area)
|
|
||||||
{
|
{
|
||||||
GdkWindow *tmp_window;
|
GdkVisual *visual;
|
||||||
GdkEventExpose event;
|
GdkPixmap *pixmap;
|
||||||
|
GtkStyle *style;
|
||||||
|
GdkScreen *screen = gdk_screen_get_default ();
|
||||||
|
GdkWindow *window;
|
||||||
|
gint width, height;
|
||||||
|
|
||||||
event.type = GDK_EXPOSE;
|
|
||||||
event.window = pixmap;
|
|
||||||
event.send_event = FALSE;
|
|
||||||
event.area = area ? *area : widget->allocation;
|
|
||||||
event.region = NULL;
|
|
||||||
event.count = 0;
|
|
||||||
|
|
||||||
tmp_window = widget->window;
|
|
||||||
widget->window = pixmap;
|
|
||||||
gtk_widget_send_expose (widget, (GdkEvent *) &event);
|
|
||||||
widget->window = tmp_window;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
hbox_foreach (GtkWidget *widget,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
if (gtk_widget_get_visible (widget)) {
|
|
||||||
gtk_widget_realize (widget);
|
|
||||||
gtk_widget_map (widget);
|
|
||||||
gtk_widget_ensure_style (widget);
|
gtk_widget_ensure_style (widget);
|
||||||
fake_expose_widget (widget, (GdkPixmap *) data, NULL);
|
|
||||||
}
|
style = gtk_widget_get_style (widget);
|
||||||
|
|
||||||
|
g_assert (style);
|
||||||
|
g_assert (style->font_desc);
|
||||||
|
|
||||||
|
gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
|
||||||
|
|
||||||
|
visual = gtk_widget_get_visual (widget);
|
||||||
|
pixmap = gdk_pixmap_new (NULL, width, height, visual->depth);
|
||||||
|
gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), gtk_widget_get_colormap (widget));
|
||||||
|
|
||||||
|
window = gtk_widget_get_window (widget);
|
||||||
|
|
||||||
|
gdk_window_redirect_to_drawable (window, pixmap, 0, 0, 0, 0, width, height);
|
||||||
|
gdk_window_set_override_redirect (window, TRUE);
|
||||||
|
gtk_window_move (GTK_WINDOW (widget), gdk_screen_get_width (screen), gdk_screen_get_height (screen));
|
||||||
|
gtk_widget_show(widget);
|
||||||
|
|
||||||
|
gdk_window_process_updates (window, TRUE);
|
||||||
|
gtk_widget_hide(widget);
|
||||||
|
|
||||||
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -223,8 +225,8 @@ create_meta_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
|
||||||
|
|
||||||
GtkRequisition requisition;
|
GtkRequisition requisition;
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
|
GtkAllocation vbox_allocation;
|
||||||
GdkPixmap *pixmap;
|
GdkPixmap *pixmap;
|
||||||
GdkVisual *visual;
|
|
||||||
MetaFrameFlags flags;
|
MetaFrameFlags flags;
|
||||||
MetaTheme *theme;
|
MetaTheme *theme;
|
||||||
GdkPixbuf *pixbuf, *icon;
|
GdkPixbuf *pixbuf, *icon;
|
||||||
|
@ -279,14 +281,6 @@ create_meta_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
|
||||||
gtk_box_pack_start (GTK_BOX (box), radio, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (box), radio, FALSE, FALSE, 0);
|
||||||
|
|
||||||
gtk_widget_show_all (preview);
|
gtk_widget_show_all (preview);
|
||||||
gtk_widget_realize (stock_button);
|
|
||||||
gtk_widget_realize (GTK_BIN (stock_button)->child);
|
|
||||||
gtk_widget_realize (checkbox);
|
|
||||||
gtk_widget_realize (radio);
|
|
||||||
gtk_widget_map (stock_button);
|
|
||||||
gtk_widget_map (GTK_BIN (stock_button)->child);
|
|
||||||
gtk_widget_map (checkbox);
|
|
||||||
gtk_widget_map (radio);
|
|
||||||
|
|
||||||
meta_preview_set_frame_flags (META_PREVIEW (preview), flags);
|
meta_preview_set_frame_flags (META_PREVIEW (preview), flags);
|
||||||
meta_preview_set_theme (META_PREVIEW (preview), theme);
|
meta_preview_set_theme (META_PREVIEW (preview), theme);
|
||||||
|
@ -302,39 +296,20 @@ create_meta_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
|
||||||
gtk_widget_size_allocate (window, &allocation);
|
gtk_widget_size_allocate (window, &allocation);
|
||||||
gtk_widget_size_request (window, &requisition);
|
gtk_widget_size_request (window, &requisition);
|
||||||
|
|
||||||
/* Create a pixmap */
|
pixmap = draw_window_on_pixbuf (window);
|
||||||
visual = gtk_widget_get_visual (window);
|
|
||||||
pixmap = gdk_pixmap_new (NULL, META_THUMBNAIL_SIZE, META_THUMBNAIL_SIZE, visual->depth);
|
|
||||||
gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), gtk_widget_get_colormap (window));
|
|
||||||
|
|
||||||
/* Draw the window */
|
|
||||||
gtk_widget_ensure_style (window);
|
|
||||||
g_assert (window->style);
|
|
||||||
g_assert (window->style->font_desc);
|
|
||||||
|
|
||||||
fake_expose_widget (window, pixmap, NULL);
|
|
||||||
fake_expose_widget (preview, pixmap, NULL);
|
|
||||||
/* we call this again here because the preview sometimes draws into the area
|
|
||||||
* of the contents, see http://bugzilla.gnome.org/show_bug.cgi?id=351389 */
|
|
||||||
fake_expose_widget (window, pixmap, &vbox->allocation);
|
|
||||||
fake_expose_widget (stock_button, pixmap, NULL);
|
|
||||||
gtk_container_foreach (GTK_CONTAINER (GTK_BIN (GTK_BIN (stock_button)->child)->child),
|
|
||||||
hbox_foreach,
|
|
||||||
pixmap);
|
|
||||||
fake_expose_widget (GTK_BIN (stock_button)->child, pixmap, NULL);
|
|
||||||
fake_expose_widget (checkbox, pixmap, NULL);
|
|
||||||
fake_expose_widget (radio, pixmap, NULL);
|
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, META_THUMBNAIL_SIZE, META_THUMBNAIL_SIZE);
|
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, META_THUMBNAIL_SIZE, META_THUMBNAIL_SIZE);
|
||||||
gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, META_THUMBNAIL_SIZE, META_THUMBNAIL_SIZE);
|
gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, META_THUMBNAIL_SIZE, META_THUMBNAIL_SIZE);
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (vbox, &vbox_allocation);
|
||||||
|
|
||||||
/* Add the icon theme to the pixbuf */
|
/* Add the icon theme to the pixbuf */
|
||||||
gdk_pixbuf_composite (icon, pixbuf,
|
gdk_pixbuf_composite (icon, pixbuf,
|
||||||
vbox->allocation.x + vbox->allocation.width - icon_width - 5,
|
vbox_allocation.x + vbox_allocation.width - icon_width - 5,
|
||||||
vbox->allocation.y + vbox->allocation.height - icon_height - 5,
|
vbox_allocation.y + vbox_allocation.height - icon_height - 5,
|
||||||
icon_width, icon_height,
|
icon_width, icon_height,
|
||||||
vbox->allocation.x + vbox->allocation.width - icon_width - 5,
|
vbox_allocation.x + vbox_allocation.width - icon_width - 5,
|
||||||
vbox->allocation.y + vbox->allocation.height - icon_height - 5,
|
vbox_allocation.y + vbox_allocation.height - icon_height - 5,
|
||||||
1.0, 1.0, GDK_INTERP_BILINEAR, 255);
|
1.0, 1.0, GDK_INTERP_BILINEAR, 255);
|
||||||
region = meta_preview_get_clip_region (META_PREVIEW (preview),
|
region = meta_preview_get_clip_region (META_PREVIEW (preview),
|
||||||
META_THUMBNAIL_SIZE, META_THUMBNAIL_SIZE);
|
META_THUMBNAIL_SIZE, META_THUMBNAIL_SIZE);
|
||||||
|
@ -344,6 +319,7 @@ create_meta_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
|
||||||
g_object_unref (icon);
|
g_object_unref (icon);
|
||||||
gtk_widget_destroy (window);
|
gtk_widget_destroy (window);
|
||||||
meta_theme_free (theme);
|
meta_theme_free (theme);
|
||||||
|
gdk_pixmap_unref (pixmap);
|
||||||
|
|
||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
@ -355,7 +331,6 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
|
||||||
GtkWidget *window, *vbox, *box, *stock_button, *checkbox, *radio;
|
GtkWidget *window, *vbox, *box, *stock_button, *checkbox, *radio;
|
||||||
GtkRequisition requisition;
|
GtkRequisition requisition;
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
GdkVisual *visual;
|
|
||||||
GdkPixmap *pixmap;
|
GdkPixmap *pixmap;
|
||||||
GdkPixbuf *pixbuf, *retval;
|
GdkPixbuf *pixbuf, *retval;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
@ -382,11 +357,11 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
|
||||||
|
|
||||||
gtk_widget_show_all (vbox);
|
gtk_widget_show_all (vbox);
|
||||||
gtk_widget_realize (stock_button);
|
gtk_widget_realize (stock_button);
|
||||||
gtk_widget_realize (GTK_BIN (stock_button)->child);
|
gtk_widget_realize (gtk_bin_get_child (GTK_BIN (stock_button)));
|
||||||
gtk_widget_realize (checkbox);
|
gtk_widget_realize (checkbox);
|
||||||
gtk_widget_realize (radio);
|
gtk_widget_realize (radio);
|
||||||
gtk_widget_map (stock_button);
|
gtk_widget_map (stock_button);
|
||||||
gtk_widget_map (GTK_BIN (stock_button)->child);
|
gtk_widget_map (gtk_bin_get_child (GTK_BIN (stock_button)));
|
||||||
gtk_widget_map (checkbox);
|
gtk_widget_map (checkbox);
|
||||||
gtk_widget_map (radio);
|
gtk_widget_map (radio);
|
||||||
|
|
||||||
|
@ -398,25 +373,9 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
|
||||||
gtk_widget_size_allocate (window, &allocation);
|
gtk_widget_size_allocate (window, &allocation);
|
||||||
gtk_widget_size_request (window, &requisition);
|
gtk_widget_size_request (window, &requisition);
|
||||||
|
|
||||||
/* Draw the window */
|
|
||||||
gtk_widget_ensure_style (window);
|
|
||||||
g_assert (window->style);
|
|
||||||
g_assert (window->style->font_desc);
|
|
||||||
|
|
||||||
gtk_window_get_size (GTK_WINDOW (window), &width, &height);
|
gtk_window_get_size (GTK_WINDOW (window), &width, &height);
|
||||||
|
|
||||||
visual = gtk_widget_get_visual (window);
|
pixmap = draw_window_on_pixbuf (window);
|
||||||
pixmap = gdk_pixmap_new (NULL, width, height, visual->depth);
|
|
||||||
gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), gtk_widget_get_colormap (window));
|
|
||||||
|
|
||||||
fake_expose_widget (window, pixmap, NULL);
|
|
||||||
fake_expose_widget (stock_button, pixmap, NULL);
|
|
||||||
gtk_container_foreach (GTK_CONTAINER (GTK_BIN (GTK_BIN (stock_button)->child)->child),
|
|
||||||
hbox_foreach,
|
|
||||||
pixmap);
|
|
||||||
fake_expose_widget (GTK_BIN (stock_button)->child, pixmap, NULL);
|
|
||||||
fake_expose_widget (checkbox, pixmap, NULL);
|
|
||||||
fake_expose_widget (radio, pixmap, NULL);
|
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
|
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
|
||||||
gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, width, height);
|
gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, width, height);
|
||||||
|
@ -427,6 +386,7 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
|
||||||
GDK_INTERP_BILINEAR);
|
GDK_INTERP_BILINEAR);
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
gtk_widget_destroy (window);
|
gtk_widget_destroy (window);
|
||||||
|
gdk_pixmap_unref (pixmap);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -439,7 +399,6 @@ create_metacity_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
|
||||||
MetaTheme *theme;
|
MetaTheme *theme;
|
||||||
GtkRequisition requisition;
|
GtkRequisition requisition;
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
GdkVisual *visual;
|
|
||||||
GdkPixmap *pixmap;
|
GdkPixmap *pixmap;
|
||||||
GdkPixbuf *pixbuf, *retval;
|
GdkPixbuf *pixbuf, *retval;
|
||||||
GdkRegion *region;
|
GdkRegion *region;
|
||||||
|
@ -484,19 +443,7 @@ create_metacity_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
|
||||||
gtk_widget_size_allocate (window, &allocation);
|
gtk_widget_size_allocate (window, &allocation);
|
||||||
gtk_widget_size_request (window, &requisition);
|
gtk_widget_size_request (window, &requisition);
|
||||||
|
|
||||||
/* Draw the window */
|
pixmap = draw_window_on_pixbuf (window);
|
||||||
gtk_widget_ensure_style (window);
|
|
||||||
g_assert (window->style);
|
|
||||||
g_assert (window->style->font_desc);
|
|
||||||
|
|
||||||
/* Create a pixmap */
|
|
||||||
visual = gtk_widget_get_visual (window);
|
|
||||||
pixmap = gdk_pixmap_new (NULL, (int) METACITY_THUMBNAIL_WIDTH * 1.2, (int) METACITY_THUMBNAIL_HEIGHT * 1.2, visual->depth);
|
|
||||||
gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), gtk_widget_get_colormap (window));
|
|
||||||
|
|
||||||
fake_expose_widget (window, pixmap, NULL);
|
|
||||||
fake_expose_widget (preview, pixmap, NULL);
|
|
||||||
fake_expose_widget (window, pixmap, &dummy->allocation);
|
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, (int) METACITY_THUMBNAIL_WIDTH * 1.2, (int) METACITY_THUMBNAIL_HEIGHT * 1.2);
|
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, (int) METACITY_THUMBNAIL_WIDTH * 1.2, (int) METACITY_THUMBNAIL_HEIGHT * 1.2);
|
||||||
gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, (int) METACITY_THUMBNAIL_WIDTH * 1.2, (int) METACITY_THUMBNAIL_HEIGHT * 1.2);
|
gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, (int) METACITY_THUMBNAIL_WIDTH * 1.2, (int) METACITY_THUMBNAIL_HEIGHT * 1.2);
|
||||||
|
@ -515,6 +462,8 @@ create_metacity_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data)
|
||||||
|
|
||||||
gtk_widget_destroy (window);
|
gtk_widget_destroy (window);
|
||||||
meta_theme_free (theme);
|
meta_theme_free (theme);
|
||||||
|
gdk_pixmap_unref (pixmap);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -419,12 +419,15 @@ static void
|
||||||
get_viewport (FooScrollArea *scroll_area,
|
get_viewport (FooScrollArea *scroll_area,
|
||||||
GdkRectangle *viewport)
|
GdkRectangle *viewport)
|
||||||
{
|
{
|
||||||
|
GtkAllocation allocation;
|
||||||
GtkWidget *widget = GTK_WIDGET (scroll_area);
|
GtkWidget *widget = GTK_WIDGET (scroll_area);
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
viewport->x = scroll_area->priv->x_offset;
|
viewport->x = scroll_area->priv->x_offset;
|
||||||
viewport->y = scroll_area->priv->y_offset;
|
viewport->y = scroll_area->priv->y_offset;
|
||||||
viewport->width = widget->allocation.width;
|
viewport->width = allocation.width;
|
||||||
viewport->height = widget->allocation.height;
|
viewport->height = allocation.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -444,7 +447,7 @@ clear_exposed_input_region (FooScrollArea *area,
|
||||||
GdkRegion *viewport;
|
GdkRegion *viewport;
|
||||||
GdkRectangle allocation;
|
GdkRectangle allocation;
|
||||||
|
|
||||||
allocation = GTK_WIDGET (area)->allocation;
|
gtk_widget_get_allocation (GTK_WIDGET (area), &allocation);
|
||||||
allocation.x = 0;
|
allocation.x = 0;
|
||||||
allocation.y = 0;
|
allocation.y = 0;
|
||||||
allocation_to_canvas (area, &allocation.x, &allocation.y);
|
allocation_to_canvas (area, &allocation.x, &allocation.y);
|
||||||
|
@ -522,7 +525,7 @@ static void
|
||||||
initialize_background (GtkWidget *widget,
|
initialize_background (GtkWidget *widget,
|
||||||
cairo_t *cr)
|
cairo_t *cr)
|
||||||
{
|
{
|
||||||
setup_background_cr (widget->window, cr, 0, 0);
|
setup_background_cr (gtk_widget_get_window (widget), cr, 0, 0);
|
||||||
|
|
||||||
cairo_paint (cr);
|
cairo_paint (cr);
|
||||||
}
|
}
|
||||||
|
@ -574,6 +577,8 @@ foo_scroll_area_expose (GtkWidget *widget,
|
||||||
GdkRegion *region;
|
GdkRegion *region;
|
||||||
int x_offset, y_offset;
|
int x_offset, y_offset;
|
||||||
GdkGC *gc;
|
GdkGC *gc;
|
||||||
|
GtkAllocation widget_allocation;
|
||||||
|
GdkWindow *window = gtk_widget_get_window (widget);
|
||||||
|
|
||||||
/* I don't think expose can ever recurse for the same area */
|
/* I don't think expose can ever recurse for the same area */
|
||||||
g_assert (!scroll_area->priv->expose_region);
|
g_assert (!scroll_area->priv->expose_region);
|
||||||
|
@ -623,13 +628,14 @@ foo_scroll_area_expose (GtkWidget *widget,
|
||||||
scroll_area->priv->current_input = NULL;
|
scroll_area->priv->current_input = NULL;
|
||||||
|
|
||||||
/* Finally draw the backing pixmap */
|
/* Finally draw the backing pixmap */
|
||||||
gc = gdk_gc_new (widget->window);
|
gc = gdk_gc_new (window);
|
||||||
|
|
||||||
gdk_gc_set_clip_region (gc, expose->region);
|
gdk_gc_set_clip_region (gc, expose->region);
|
||||||
|
|
||||||
gdk_draw_drawable (widget->window, gc, scroll_area->priv->pixmap,
|
gtk_widget_get_allocation (widget, &widget_allocation);
|
||||||
0, 0, widget->allocation.x, widget->allocation.y,
|
gdk_draw_drawable (window, gc, scroll_area->priv->pixmap,
|
||||||
widget->allocation.width, widget->allocation.height);
|
0, 0, widget_allocation.x, widget_allocation.y,
|
||||||
|
widget_allocation.width, widget_allocation.height);
|
||||||
|
|
||||||
g_object_unref (gc);
|
g_object_unref (gc);
|
||||||
gdk_region_destroy (region);
|
gdk_region_destroy (region);
|
||||||
|
@ -676,15 +682,12 @@ emit_viewport_changed (FooScrollArea *scroll_area,
|
||||||
static void
|
static void
|
||||||
clamp_adjustment (GtkAdjustment *adj)
|
clamp_adjustment (GtkAdjustment *adj)
|
||||||
{
|
{
|
||||||
double old_value = adj->value;
|
if (gtk_adjustment_get_upper (adj) >= gtk_adjustment_get_page_size (adj))
|
||||||
|
gtk_adjustment_set_value (adj, CLAMP (gtk_adjustment_get_value (adj), 0.0,
|
||||||
if (adj->upper >= adj->page_size)
|
gtk_adjustment_get_upper (adj)
|
||||||
adj->value = CLAMP (adj->value, 0.0, adj->upper - adj->page_size);
|
- gtk_adjustment_get_page_size (adj)));
|
||||||
else
|
else
|
||||||
adj->value = 0.0;
|
gtk_adjustment_set_value (adj, 0.0);
|
||||||
|
|
||||||
if (old_value != adj->value)
|
|
||||||
gtk_adjustment_value_changed (adj);
|
|
||||||
|
|
||||||
gtk_adjustment_changed (adj);
|
gtk_adjustment_changed (adj);
|
||||||
}
|
}
|
||||||
|
@ -692,24 +695,29 @@ clamp_adjustment (GtkAdjustment *adj)
|
||||||
static gboolean
|
static gboolean
|
||||||
set_adjustment_values (FooScrollArea *scroll_area)
|
set_adjustment_values (FooScrollArea *scroll_area)
|
||||||
{
|
{
|
||||||
GtkAllocation *allocation = >K_WIDGET (scroll_area)->allocation;
|
GtkAllocation allocation;
|
||||||
|
|
||||||
GtkAdjustment *hadj = scroll_area->priv->hadj;
|
GtkAdjustment *hadj = scroll_area->priv->hadj;
|
||||||
GtkAdjustment *vadj = scroll_area->priv->vadj;
|
GtkAdjustment *vadj = scroll_area->priv->vadj;
|
||||||
|
|
||||||
/* Horizontal */
|
/* Horizontal */
|
||||||
hadj->page_size = allocation->width;
|
gtk_widget_get_allocation (GTK_WIDGET (scroll_area), &allocation);
|
||||||
hadj->step_increment = 0.1 * allocation->width;
|
g_object_freeze_notify (G_OBJECT (hadj));
|
||||||
hadj->page_increment = 0.9 * allocation->width;
|
gtk_adjustment_set_page_size (hadj, allocation.width);
|
||||||
hadj->lower = 0.0;
|
gtk_adjustment_set_step_increment (hadj, 0.1 * allocation.width);
|
||||||
hadj->upper = scroll_area->priv->width;
|
gtk_adjustment_set_page_increment (hadj, 0.9 * allocation.width);
|
||||||
|
gtk_adjustment_set_lower (hadj, 0.0);
|
||||||
|
gtk_adjustment_set_upper (hadj, scroll_area->priv->width);
|
||||||
|
g_object_thaw_notify (G_OBJECT (hadj));
|
||||||
|
|
||||||
/* Vertical */
|
/* Vertical */
|
||||||
vadj->page_size = allocation->height;
|
g_object_freeze_notify (G_OBJECT (vadj));
|
||||||
vadj->step_increment = 0.1 * allocation->height;
|
gtk_adjustment_set_page_size (vadj, allocation.height);
|
||||||
vadj->page_increment = 0.9 * allocation->height;
|
gtk_adjustment_set_step_increment (vadj, 0.1 * allocation.height);
|
||||||
vadj->lower = 0.0;
|
gtk_adjustment_set_page_increment (vadj, 0.9 * allocation.height);
|
||||||
vadj->upper = scroll_area->priv->height;
|
gtk_adjustment_set_lower (vadj, 0.0);
|
||||||
|
gtk_adjustment_set_upper (vadj, scroll_area->priv->height);
|
||||||
|
g_object_thaw_notify (G_OBJECT (vadj));
|
||||||
|
|
||||||
clamp_adjustment (hadj);
|
clamp_adjustment (hadj);
|
||||||
clamp_adjustment (vadj);
|
clamp_adjustment (vadj);
|
||||||
|
@ -722,15 +730,18 @@ foo_scroll_area_realize (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
FooScrollArea *area = FOO_SCROLL_AREA (widget);
|
FooScrollArea *area = FOO_SCROLL_AREA (widget);
|
||||||
GdkWindowAttr attributes;
|
GdkWindowAttr attributes;
|
||||||
|
GtkAllocation widget_allocation;
|
||||||
|
GdkWindow *window;
|
||||||
gint attributes_mask;
|
gint attributes_mask;
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &widget_allocation);
|
||||||
gtk_widget_set_realized (widget, TRUE);
|
gtk_widget_set_realized (widget, TRUE);
|
||||||
|
|
||||||
attributes.window_type = GDK_WINDOW_CHILD;
|
attributes.window_type = GDK_WINDOW_CHILD;
|
||||||
attributes.x = widget->allocation.x;
|
attributes.x = widget_allocation.x;
|
||||||
attributes.y = widget->allocation.y;
|
attributes.y = widget_allocation.y;
|
||||||
attributes.width = widget->allocation.width;
|
attributes.width = widget_allocation.width;
|
||||||
attributes.height = widget->allocation.height;
|
attributes.height = widget_allocation.height;
|
||||||
attributes.wclass = GDK_INPUT_ONLY;
|
attributes.wclass = GDK_INPUT_ONLY;
|
||||||
attributes.event_mask = gtk_widget_get_events (widget);
|
attributes.event_mask = gtk_widget_get_events (widget);
|
||||||
attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
|
attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
|
||||||
|
@ -744,18 +755,19 @@ foo_scroll_area_realize (GtkWidget *widget)
|
||||||
|
|
||||||
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
||||||
|
|
||||||
widget->window = gtk_widget_get_parent_window (widget);
|
window = gtk_widget_get_parent_window (widget);
|
||||||
g_object_ref (widget->window);
|
gtk_widget_set_window (widget, window);
|
||||||
|
g_object_ref (window);
|
||||||
|
|
||||||
area->priv->input_window = gdk_window_new (widget->window,
|
area->priv->input_window = gdk_window_new (window,
|
||||||
&attributes, attributes_mask);
|
&attributes, attributes_mask);
|
||||||
area->priv->pixmap = gdk_pixmap_new (widget->window,
|
area->priv->pixmap = gdk_pixmap_new (window,
|
||||||
widget->allocation.width,
|
widget_allocation.width,
|
||||||
widget->allocation.height,
|
widget_allocation.height,
|
||||||
-1);
|
-1);
|
||||||
gdk_window_set_user_data (area->priv->input_window, area);
|
gdk_window_set_user_data (area->priv->input_window, area);
|
||||||
|
|
||||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
gtk_widget_style_attach (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -777,9 +789,13 @@ static GdkPixmap *
|
||||||
create_new_pixmap (GtkWidget *widget,
|
create_new_pixmap (GtkWidget *widget,
|
||||||
GdkPixmap *old)
|
GdkPixmap *old)
|
||||||
{
|
{
|
||||||
GdkPixmap *new = gdk_pixmap_new (widget->window,
|
GtkAllocation widget_allocation;
|
||||||
widget->allocation.width,
|
GdkPixmap *new;
|
||||||
widget->allocation.height,
|
|
||||||
|
gtk_widget_get_allocation (widget, &widget_allocation);
|
||||||
|
new = gdk_pixmap_new (gtk_widget_get_window (widget),
|
||||||
|
widget_allocation.width,
|
||||||
|
widget_allocation.height,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
/* Unfortunately we don't know in which direction we were resized,
|
/* Unfortunately we don't know in which direction we were resized,
|
||||||
|
@ -811,12 +827,14 @@ foo_scroll_area_size_allocate (GtkWidget *widget,
|
||||||
GdkRectangle old_viewport;
|
GdkRectangle old_viewport;
|
||||||
GdkRegion *old_allocation;
|
GdkRegion *old_allocation;
|
||||||
GdkRegion *invalid;
|
GdkRegion *invalid;
|
||||||
|
GtkAllocation widget_allocation;
|
||||||
|
|
||||||
get_viewport (scroll_area, &old_viewport);
|
get_viewport (scroll_area, &old_viewport);
|
||||||
|
|
||||||
old_allocation = gdk_region_rectangle (&widget->allocation);
|
gtk_widget_get_allocation (widget, &widget_allocation);
|
||||||
|
old_allocation = gdk_region_rectangle (&widget_allocation);
|
||||||
gdk_region_offset (old_allocation,
|
gdk_region_offset (old_allocation,
|
||||||
-widget->allocation.x, -widget->allocation.y);
|
-widget_allocation.x, -widget_allocation.y);
|
||||||
invalid = gdk_region_rectangle (allocation);
|
invalid = gdk_region_rectangle (allocation);
|
||||||
gdk_region_offset (invalid, -allocation->x, -allocation->y);
|
gdk_region_offset (invalid, -allocation->x, -allocation->y);
|
||||||
gdk_region_xor (invalid, old_allocation);
|
gdk_region_xor (invalid, old_allocation);
|
||||||
|
@ -825,7 +843,7 @@ foo_scroll_area_size_allocate (GtkWidget *widget,
|
||||||
gdk_region_destroy (old_allocation);
|
gdk_region_destroy (old_allocation);
|
||||||
gdk_region_destroy (invalid);
|
gdk_region_destroy (invalid);
|
||||||
|
|
||||||
widget->allocation = *allocation;
|
gtk_widget_set_allocation (widget, allocation);
|
||||||
|
|
||||||
if (scroll_area->priv->input_window)
|
if (scroll_area->priv->input_window)
|
||||||
{
|
{
|
||||||
|
@ -959,7 +977,7 @@ process_event (FooScrollArea *scroll_area,
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
gboolean inside;
|
gboolean inside;
|
||||||
|
|
||||||
cr = gdk_cairo_create (widget->window);
|
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
||||||
cairo_set_fill_rule (cr, path->fill_rule);
|
cairo_set_fill_rule (cr, path->fill_rule);
|
||||||
cairo_set_line_width (cr, path->line_width);
|
cairo_set_line_width (cr, path->line_width);
|
||||||
cairo_append_path (cr, path->path);
|
cairo_append_path (cr, path->path);
|
||||||
|
@ -1052,21 +1070,17 @@ foo_scroll_area_set_size_fixed_y (FooScrollArea *scroll_area,
|
||||||
int old_y,
|
int old_y,
|
||||||
int new_y)
|
int new_y)
|
||||||
{
|
{
|
||||||
int dy = new_y - old_y;
|
|
||||||
|
|
||||||
scroll_area->priv->width = width;
|
scroll_area->priv->width = width;
|
||||||
scroll_area->priv->height = height;
|
scroll_area->priv->height = height;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
g_print ("diff: %d\n", new_y - old_y);
|
g_print ("diff: %d\n", new_y - old_y);
|
||||||
#endif
|
#endif
|
||||||
|
g_object_thaw_notify (G_OBJECT (scroll_area->priv->vadj));
|
||||||
scroll_area->priv->vadj->value += dy;
|
gtk_adjustment_set_value (scroll_area->priv->vadj, new_y);
|
||||||
|
|
||||||
set_adjustment_values (scroll_area);
|
set_adjustment_values (scroll_area);
|
||||||
|
g_object_thaw_notify (G_OBJECT (scroll_area->priv->vadj));
|
||||||
if (dy != 0)
|
|
||||||
gtk_adjustment_value_changed (scroll_area->priv->vadj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1186,11 +1200,12 @@ foo_scroll_area_scroll (FooScrollArea *area,
|
||||||
gint dx,
|
gint dx,
|
||||||
gint dy)
|
gint dy)
|
||||||
{
|
{
|
||||||
GdkRectangle allocation = GTK_WIDGET (area)->allocation;
|
GdkRectangle allocation;
|
||||||
GdkRectangle src_area;
|
GdkRectangle src_area;
|
||||||
GdkRectangle move_area;
|
GdkRectangle move_area;
|
||||||
GdkRegion *invalid_region;
|
GdkRegion *invalid_region;
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (GTK_WIDGET (area), &allocation);
|
||||||
allocation.x = 0;
|
allocation.x = 0;
|
||||||
allocation.y = 0;
|
allocation.y = 0;
|
||||||
|
|
||||||
|
@ -1250,13 +1265,13 @@ foo_scrollbar_adjustment_changed (GtkAdjustment *adj,
|
||||||
/* FIXME: do we treat the offset as int or double, and,
|
/* FIXME: do we treat the offset as int or double, and,
|
||||||
* if int, how do we round?
|
* if int, how do we round?
|
||||||
*/
|
*/
|
||||||
dx = (int)adj->value - scroll_area->priv->x_offset;
|
dx = (int)gtk_adjustment_get_value (adj) - scroll_area->priv->x_offset;
|
||||||
scroll_area->priv->x_offset = adj->value;
|
scroll_area->priv->x_offset = gtk_adjustment_get_value (adj);
|
||||||
}
|
}
|
||||||
else if (adj == scroll_area->priv->vadj)
|
else if (adj == scroll_area->priv->vadj)
|
||||||
{
|
{
|
||||||
dy = (int)adj->value - scroll_area->priv->y_offset;
|
dy = (int)gtk_adjustment_get_value (adj) - scroll_area->priv->y_offset;
|
||||||
scroll_area->priv->y_offset = adj->value;
|
scroll_area->priv->y_offset = gtk_adjustment_get_value (adj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1430,34 +1445,40 @@ foo_scroll_area_add_input_from_stroke (FooScrollArea *scroll_area,
|
||||||
void
|
void
|
||||||
foo_scroll_area_invalidate (FooScrollArea *scroll_area)
|
foo_scroll_area_invalidate (FooScrollArea *scroll_area)
|
||||||
{
|
{
|
||||||
|
GtkAllocation allocation;
|
||||||
GtkWidget *widget = GTK_WIDGET (scroll_area);
|
GtkWidget *widget = GTK_WIDGET (scroll_area);
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
foo_scroll_area_invalidate_rect (scroll_area,
|
foo_scroll_area_invalidate_rect (scroll_area,
|
||||||
scroll_area->priv->x_offset, scroll_area->priv->y_offset,
|
scroll_area->priv->x_offset, scroll_area->priv->y_offset,
|
||||||
widget->allocation.width,
|
allocation.width,
|
||||||
widget->allocation.height);
|
allocation.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
canvas_to_window (FooScrollArea *area,
|
canvas_to_window (FooScrollArea *area,
|
||||||
GdkRegion *region)
|
GdkRegion *region)
|
||||||
{
|
{
|
||||||
|
GtkAllocation allocation;
|
||||||
GtkWidget *widget = GTK_WIDGET (area);
|
GtkWidget *widget = GTK_WIDGET (area);
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
gdk_region_offset (region,
|
gdk_region_offset (region,
|
||||||
-area->priv->x_offset + widget->allocation.x,
|
-area->priv->x_offset + allocation.x,
|
||||||
-area->priv->y_offset + widget->allocation.y);
|
-area->priv->y_offset + allocation.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
window_to_canvas (FooScrollArea *area,
|
window_to_canvas (FooScrollArea *area,
|
||||||
GdkRegion *region)
|
GdkRegion *region)
|
||||||
{
|
{
|
||||||
|
GtkAllocation allocation;
|
||||||
GtkWidget *widget = GTK_WIDGET (area);
|
GtkWidget *widget = GTK_WIDGET (area);
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
gdk_region_offset (region,
|
gdk_region_offset (region,
|
||||||
area->priv->x_offset - widget->allocation.x,
|
area->priv->x_offset - allocation.x,
|
||||||
area->priv->y_offset - widget->allocation.y);
|
area->priv->y_offset - allocation.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1539,19 +1560,14 @@ foo_scroll_area_set_viewport_pos (FooScrollArea *scroll_area,
|
||||||
int x,
|
int x,
|
||||||
int y)
|
int y)
|
||||||
{
|
{
|
||||||
int x_changed = scroll_area->priv->hadj->value != (double)x;
|
g_object_freeze_notify (G_OBJECT (scroll_area->priv->hadj));
|
||||||
int y_changed = scroll_area->priv->vadj->value != (double)y;
|
g_object_freeze_notify (G_OBJECT (scroll_area->priv->vadj));
|
||||||
|
gtk_adjustment_set_value (scroll_area->priv->hadj, x);
|
||||||
scroll_area->priv->hadj->value = x;
|
gtk_adjustment_set_value (scroll_area->priv->vadj, y);
|
||||||
scroll_area->priv->vadj->value = y;
|
|
||||||
|
|
||||||
set_adjustment_values (scroll_area);
|
set_adjustment_values (scroll_area);
|
||||||
|
g_object_thaw_notify (G_OBJECT (scroll_area->priv->hadj));
|
||||||
if (x_changed)
|
g_object_thaw_notify (G_OBJECT (scroll_area->priv->vadj));
|
||||||
gtk_adjustment_value_changed (scroll_area->priv->hadj);
|
|
||||||
|
|
||||||
if (y_changed)
|
|
||||||
gtk_adjustment_value_changed (scroll_area->priv->vadj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -521,7 +521,7 @@ rebuild_current_monitor_label (App *app)
|
||||||
{
|
{
|
||||||
GdkColor black = { 0, 0, 0, 0 };
|
GdkColor black = { 0, 0, 0, 0 };
|
||||||
|
|
||||||
gtk_widget_modify_bg (app->current_monitor_event_box, app->current_monitor_event_box->state, &color);
|
gtk_widget_modify_bg (app->current_monitor_event_box, gtk_widget_get_state (app->current_monitor_event_box), &color);
|
||||||
|
|
||||||
/* Make the label explicitly black. We don't want it to follow the
|
/* Make the label explicitly black. We don't want it to follow the
|
||||||
* theme's colors, since the label is always shown against a light
|
* theme's colors, since the label is always shown against a light
|
||||||
|
@ -1659,15 +1659,17 @@ paint_background (FooScrollArea *area,
|
||||||
{
|
{
|
||||||
GdkRectangle viewport;
|
GdkRectangle viewport;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
GtkStyle *widget_style;
|
||||||
|
|
||||||
widget = GTK_WIDGET (area);
|
widget = GTK_WIDGET (area);
|
||||||
|
|
||||||
foo_scroll_area_get_viewport (area, &viewport);
|
foo_scroll_area_get_viewport (area, &viewport);
|
||||||
|
widget_style = gtk_widget_get_style (widget);
|
||||||
|
|
||||||
cairo_set_source_rgb (cr,
|
cairo_set_source_rgb (cr,
|
||||||
widget->style->base[GTK_STATE_SELECTED].red / 65535.0,
|
widget_style->base[GTK_STATE_SELECTED].red / 65535.0,
|
||||||
widget->style->base[GTK_STATE_SELECTED].green / 65535.0,
|
widget_style->base[GTK_STATE_SELECTED].green / 65535.0,
|
||||||
widget->style->base[GTK_STATE_SELECTED].blue / 65535.0);
|
widget_style->base[GTK_STATE_SELECTED].blue / 65535.0);
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
viewport.x, viewport.y,
|
viewport.x, viewport.y,
|
||||||
|
@ -1678,9 +1680,9 @@ paint_background (FooScrollArea *area,
|
||||||
foo_scroll_area_add_input_from_fill (area, cr, on_canvas_event, NULL);
|
foo_scroll_area_add_input_from_fill (area, cr, on_canvas_event, NULL);
|
||||||
|
|
||||||
cairo_set_source_rgb (cr,
|
cairo_set_source_rgb (cr,
|
||||||
widget->style->dark[GTK_STATE_SELECTED].red / 65535.0,
|
widget_style->dark[GTK_STATE_SELECTED].red / 65535.0,
|
||||||
widget->style->dark[GTK_STATE_SELECTED].green / 65535.0,
|
widget_style->dark[GTK_STATE_SELECTED].green / 65535.0,
|
||||||
widget->style->dark[GTK_STATE_SELECTED].blue / 65535.0);
|
widget_style->dark[GTK_STATE_SELECTED].blue / 65535.0);
|
||||||
|
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
}
|
}
|
||||||
|
@ -2252,7 +2254,7 @@ static void
|
||||||
select_current_output_from_dialog_position (App *app)
|
select_current_output_from_dialog_position (App *app)
|
||||||
{
|
{
|
||||||
if (gtk_widget_get_realized (app->dialog))
|
if (gtk_widget_get_realized (app->dialog))
|
||||||
app->current_output = get_output_for_window (app->current_configuration, app->dialog->window);
|
app->current_output = get_output_for_window (app->current_configuration, gtk_widget_get_window (app->dialog));
|
||||||
else
|
else
|
||||||
app->current_output = NULL;
|
app->current_output = NULL;
|
||||||
|
|
||||||
|
|
|
@ -559,21 +559,23 @@ egg_cell_renderer_keys_start_editing (GtkCellRenderer *cell,
|
||||||
EggCellRendererKeys *keys;
|
EggCellRendererKeys *keys;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *eventbox;
|
GtkWidget *eventbox;
|
||||||
|
GValue celltext_editable = {0};
|
||||||
|
|
||||||
celltext = GTK_CELL_RENDERER_TEXT (cell);
|
celltext = GTK_CELL_RENDERER_TEXT (cell);
|
||||||
keys = EGG_CELL_RENDERER_KEYS (cell);
|
keys = EGG_CELL_RENDERER_KEYS (cell);
|
||||||
|
|
||||||
/* If the cell isn't editable we return NULL. */
|
/* If the cell isn't editable we return NULL. */
|
||||||
if (celltext->editable == FALSE)
|
g_value_init (&celltext_editable, G_TYPE_BOOLEAN);
|
||||||
|
g_object_get_property (G_OBJECT (celltext), "editable", &celltext_editable);
|
||||||
|
if (g_value_get_boolean (&celltext_editable) == FALSE)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
g_return_val_if_fail (gtk_widget_get_window (widget) != NULL, NULL);
|
||||||
|
|
||||||
g_return_val_if_fail (widget->window != NULL, NULL);
|
if (gdk_keyboard_grab (gtk_widget_get_window (widget), FALSE,
|
||||||
|
|
||||||
if (gdk_keyboard_grab (widget->window, FALSE,
|
|
||||||
gdk_event_get_time (event)) != GDK_GRAB_SUCCESS)
|
gdk_event_get_time (event)) != GDK_GRAB_SUCCESS)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (gdk_pointer_grab (widget->window, FALSE,
|
if (gdk_pointer_grab (gtk_widget_get_window (widget), FALSE,
|
||||||
GDK_BUTTON_PRESS_MASK,
|
GDK_BUTTON_PRESS_MASK,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
gdk_event_get_time (event)) != GDK_GRAB_SUCCESS)
|
gdk_event_get_time (event)) != GDK_GRAB_SUCCESS)
|
||||||
|
@ -598,10 +600,10 @@ egg_cell_renderer_keys_start_editing (GtkCellRenderer *cell,
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||||
|
|
||||||
gtk_widget_modify_bg (eventbox, GTK_STATE_NORMAL,
|
gtk_widget_modify_bg (eventbox, GTK_STATE_NORMAL,
|
||||||
&widget->style->bg[GTK_STATE_SELECTED]);
|
>k_widget_get_style (widget)->bg[GTK_STATE_SELECTED]);
|
||||||
|
|
||||||
gtk_widget_modify_fg (label, GTK_STATE_NORMAL,
|
gtk_widget_modify_fg (label, GTK_STATE_NORMAL,
|
||||||
&widget->style->fg[GTK_STATE_SELECTED]);
|
>k_widget_get_style (widget)->fg[GTK_STATE_SELECTED]);
|
||||||
|
|
||||||
gtk_label_set_text (GTK_LABEL (label),
|
gtk_label_set_text (GTK_LABEL (label),
|
||||||
TOOLTIP_TEXT);
|
TOOLTIP_TEXT);
|
||||||
|
|
|
@ -183,12 +183,13 @@ option_focused_cb (GtkWidget * widget, GdkEventFocus * event,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkScrolledWindow *win = GTK_SCROLLED_WINDOW (data);
|
GtkScrolledWindow *win = GTK_SCROLLED_WINDOW (data);
|
||||||
GtkAllocation *alloc = &widget->allocation;
|
GtkAllocation alloc;
|
||||||
GtkAdjustment *adj;
|
GtkAdjustment *adj;
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &alloc);
|
||||||
adj = gtk_scrolled_window_get_vadjustment (win);
|
adj = gtk_scrolled_window_get_vadjustment (win);
|
||||||
gtk_adjustment_clamp_page (adj, alloc->y,
|
gtk_adjustment_clamp_page (adj, alloc.y,
|
||||||
alloc->y + alloc->height);
|
alloc.y + alloc.height);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,8 @@ setup_accessibility (GtkBuilder *dialog, GConfClient *client)
|
||||||
WID ("threshold"), NULL);
|
WID ("threshold"), NULL);
|
||||||
|
|
||||||
gconf_peditor_new_select_radio (NULL, MT_GCONF_HOME "/dwell_mode",
|
gconf_peditor_new_select_radio (NULL, MT_GCONF_HOME "/dwell_mode",
|
||||||
GTK_RADIO_BUTTON (WID ("dwell_mode_ctw"))->group, NULL);
|
gtk_radio_button_get_group (GTK_RADIO_BUTTON (WID ("dwell_mode_ctw"))),
|
||||||
|
NULL);
|
||||||
update_mode_sensitivity (dialog,
|
update_mode_sensitivity (dialog,
|
||||||
gconf_client_get_int (client,
|
gconf_client_get_int (client,
|
||||||
MT_GCONF_HOME "/dwell_mode",
|
MT_GCONF_HOME "/dwell_mode",
|
||||||
|
|
|
@ -224,7 +224,7 @@ static void
|
||||||
cb_use_auth_toggled (GtkToggleButton *toggle,
|
cb_use_auth_toggled (GtkToggleButton *toggle,
|
||||||
GtkWidget *table)
|
GtkWidget *table)
|
||||||
{
|
{
|
||||||
gtk_widget_set_sensitive (table, toggle->active);
|
gtk_widget_set_sensitive (table, gtk_toggle_button_get_active (toggle));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -257,8 +257,6 @@ cb_http_details_button_clicked (GtkWidget *button,
|
||||||
|
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (widget), GTK_WINDOW (parent));
|
gtk_window_set_transient_for (GTK_WINDOW (widget), GTK_WINDOW (parent));
|
||||||
|
|
||||||
gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (gtk_builder_get_object (builder, "use_auth_checkbutton"))->child), TRUE);
|
|
||||||
|
|
||||||
g_signal_connect (gtk_builder_get_object (builder, "use_auth_checkbutton"),
|
g_signal_connect (gtk_builder_get_object (builder, "use_auth_checkbutton"),
|
||||||
"toggled",
|
"toggled",
|
||||||
G_CALLBACK (cb_use_auth_toggled),
|
G_CALLBACK (cb_use_auth_toggled),
|
||||||
|
@ -1240,11 +1238,6 @@ setup_dialog (GtkBuilder *builder)
|
||||||
"text", COL_NAME,
|
"text", COL_NAME,
|
||||||
"style", COL_STYLE, NULL);
|
"style", COL_STYLE, NULL);
|
||||||
|
|
||||||
/* Hackety hack */
|
|
||||||
gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (gtk_builder_get_object (builder, "none_radiobutton"))->child), TRUE);
|
|
||||||
gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (gtk_builder_get_object (builder, "manual_radiobutton"))->child), TRUE);
|
|
||||||
gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (gtk_builder_get_object (builder, "auto_radiobutton"))->child), TRUE);
|
|
||||||
|
|
||||||
/* Mode */
|
/* Mode */
|
||||||
mode_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "none_radiobutton")));
|
mode_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (gtk_builder_get_object (builder, "none_radiobutton")));
|
||||||
connect_sensitivity_signals (builder, mode_group);
|
connect_sensitivity_signals (builder, mode_group);
|
||||||
|
|
|
@ -58,12 +58,19 @@
|
||||||
<property name="spacing">18</property>
|
<property name="spacing">18</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="none_radiobutton">
|
<object class="GtkRadioButton" id="none_radiobutton">
|
||||||
<property name="label" translatable="yes"><b>Di_rect internet connection</b></property>
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label4">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes"><b>Di_rect internet connection</b></property>
|
||||||
|
<property name="use_markup">True</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -81,13 +88,20 @@
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="manual_radiobutton">
|
<object class="GtkRadioButton" id="manual_radiobutton">
|
||||||
<property name="label" translatable="yes"><b>_Manual proxy configuration</b></property>
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
<property name="group">none_radiobutton</property>
|
<property name="group">none_radiobutton</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes"><b>_Manual proxy configuration</b></property>
|
||||||
|
<property name="use_markup">True</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -426,13 +440,21 @@
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="auto_radiobutton">
|
<object class="GtkRadioButton" id="auto_radiobutton">
|
||||||
<property name="label" translatable="yes"><b>_Automatic proxy configuration</b></property>
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
<property name="yalign">0.47</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
<property name="group">none_radiobutton</property>
|
<property name="group">none_radiobutton</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes"><b>_Automatic proxy configuration</b></property>
|
||||||
|
<property name="use_markup">True</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -745,12 +767,19 @@
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton" id="use_auth_checkbutton">
|
<object class="GtkCheckButton" id="use_auth_checkbutton">
|
||||||
<property name="label" translatable="yes"><b>_Use authentication</b></property>
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes"><b>_Use authentication</b></property>
|
||||||
|
<property name="use_markup">True</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|
|
@ -354,8 +354,7 @@ try_spawn_config_tool (GdkScreen *screen)
|
||||||
gtk_window_set_title (GTK_WINDOW (no_tool_dialog), "");
|
gtk_window_set_title (GTK_WINDOW (no_tool_dialog), "");
|
||||||
gtk_window_set_resizable (GTK_WINDOW (no_tool_dialog), FALSE);
|
gtk_window_set_resizable (GTK_WINDOW (no_tool_dialog), FALSE);
|
||||||
|
|
||||||
gtk_label_set_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (no_tool_dialog)->label),
|
gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (no_tool_dialog), str);
|
||||||
str);
|
|
||||||
|
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ create_text_pixmap(GtkWidget *drawing_area, FT_Face face)
|
||||||
XftFont *font;
|
XftFont *font;
|
||||||
gint *sizes = NULL, n_sizes, alpha_size;
|
gint *sizes = NULL, n_sizes, alpha_size;
|
||||||
FcCharSet *charset = NULL;
|
FcCharSet *charset = NULL;
|
||||||
|
GdkWindow *window = gtk_widget_get_window (drawing_area);
|
||||||
|
|
||||||
text = pango_language_get_sample_string(NULL);
|
text = pango_language_get_sample_string(NULL);
|
||||||
if (! check_font_contain_text (face, text))
|
if (! check_font_contain_text (face, text))
|
||||||
|
@ -122,9 +123,9 @@ create_text_pixmap(GtkWidget *drawing_area, FT_Face face)
|
||||||
gtk_widget_realize(drawing_area);
|
gtk_widget_realize(drawing_area);
|
||||||
|
|
||||||
/* create the XftDraw */
|
/* create the XftDraw */
|
||||||
xdisplay = GDK_PIXMAP_XDISPLAY(drawing_area->window);
|
xdisplay = GDK_PIXMAP_XDISPLAY(window);
|
||||||
xvisual = GDK_VISUAL_XVISUAL(gdk_drawable_get_visual(drawing_area->window));
|
xvisual = GDK_VISUAL_XVISUAL(gdk_drawable_get_visual(window));
|
||||||
xcolormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(drawing_area->window));
|
xcolormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(window));
|
||||||
XftColorAllocName(xdisplay, xvisual, xcolormap, "black", &colour);
|
XftColorAllocName(xdisplay, xvisual, xcolormap, "black", &colour);
|
||||||
|
|
||||||
/* work out what sizes to render */
|
/* work out what sizes to render */
|
||||||
|
@ -187,11 +188,11 @@ create_text_pixmap(GtkWidget *drawing_area, FT_Face face)
|
||||||
|
|
||||||
/* create pixmap */
|
/* create pixmap */
|
||||||
gtk_widget_set_size_request(drawing_area, pixmap_width, pixmap_height);
|
gtk_widget_set_size_request(drawing_area, pixmap_width, pixmap_height);
|
||||||
pixmap = gdk_pixmap_new(drawing_area->window,
|
pixmap = gdk_pixmap_new(window,
|
||||||
pixmap_width, pixmap_height, -1);
|
pixmap_width, pixmap_height, -1);
|
||||||
if (!pixmap)
|
if (!pixmap)
|
||||||
goto end;
|
goto end;
|
||||||
gdk_draw_rectangle(pixmap, drawing_area->style->white_gc,
|
gdk_draw_rectangle(pixmap, gtk_widget_get_style(drawing_area)->white_gc,
|
||||||
TRUE, 0, 0, pixmap_width, pixmap_height);
|
TRUE, 0, 0, pixmap_width, pixmap_height);
|
||||||
|
|
||||||
xdrawable = GDK_DRAWABLE_XID(pixmap);
|
xdrawable = GDK_DRAWABLE_XID(pixmap);
|
||||||
|
@ -372,8 +373,8 @@ add_face_info(GtkWidget *table, gint *row_p, const gchar *uri, FT_Face face)
|
||||||
static gboolean
|
static gboolean
|
||||||
expose_event(GtkWidget *widget, GdkEventExpose *event, GdkPixmap *pixmap)
|
expose_event(GtkWidget *widget, GdkEventExpose *event, GdkPixmap *pixmap)
|
||||||
{
|
{
|
||||||
gdk_draw_drawable(widget->window,
|
gdk_draw_drawable(gtk_widget_get_window (widget),
|
||||||
widget->style->fg_gc[gtk_widget_get_state (widget)],
|
gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)],
|
||||||
pixmap,
|
pixmap,
|
||||||
event->area.x, event->area.y,
|
event->area.x, event->area.y,
|
||||||
event->area.x, event->area.y,
|
event->area.x, event->area.y,
|
||||||
|
|
|
@ -527,7 +527,7 @@ postpone_clicked_cb (GtkWidget *button,
|
||||||
|
|
||||||
priv->postpone_timeout_id = g_timeout_add_seconds (POSTPONE_CANCEL, (GSourceFunc) postpone_cancel_cb, bw);
|
priv->postpone_timeout_id = g_timeout_add_seconds (POSTPONE_CANCEL, (GSourceFunc) postpone_cancel_cb, bw);
|
||||||
|
|
||||||
grab_on_window (priv->postpone_entry->window, gtk_get_current_event_time ());
|
grab_on_window (gtk_widget_get_window (priv->postpone_entry), gtk_get_current_event_time ());
|
||||||
|
|
||||||
gtk_widget_grab_focus (priv->postpone_entry);
|
gtk_widget_grab_focus (priv->postpone_entry);
|
||||||
|
|
||||||
|
@ -549,24 +549,29 @@ get_layout_location (GtkLabel *label,
|
||||||
{
|
{
|
||||||
GtkMisc *misc;
|
GtkMisc *misc;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
gfloat xalign;
|
GtkAllocation widget_allocation;
|
||||||
|
GtkRequisition widget_requisition;
|
||||||
|
gfloat xalign, yalign;
|
||||||
gint x, y;
|
gint x, y;
|
||||||
|
gint xpad, ypad;
|
||||||
|
|
||||||
misc = GTK_MISC (label);
|
misc = GTK_MISC (label);
|
||||||
widget = GTK_WIDGET (label);
|
widget = GTK_WIDGET (label);
|
||||||
|
|
||||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) {
|
gtk_misc_get_alignment (misc, &xalign, &yalign);
|
||||||
xalign = misc->xalign;
|
gtk_misc_get_padding (misc, &xpad, &ypad);
|
||||||
} else {
|
gtk_widget_get_allocation (widget, &widget_allocation);
|
||||||
xalign = 1.0 - misc->xalign;
|
gtk_widget_get_requisition (widget, &widget_requisition);
|
||||||
}
|
|
||||||
|
|
||||||
x = floor (widget->allocation.x + (int)misc->xpad
|
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
|
||||||
+ ((widget->allocation.width - widget->requisition.width - 1) * xalign)
|
xalign = 1.0 - xalign;
|
||||||
|
|
||||||
|
x = floor (widget_allocation.x + (int)xpad
|
||||||
|
+ ((widget_allocation.width - widget_requisition.width - 1) * xalign)
|
||||||
+ 0.5);
|
+ 0.5);
|
||||||
|
|
||||||
y = floor (widget->allocation.y + (int)misc->ypad
|
y = floor (widget_allocation.y + (int)ypad
|
||||||
+ ((widget->allocation.height - widget->requisition.height - 1) * misc->yalign)
|
+ ((widget_allocation.height - widget_requisition.height - 1) * yalign)
|
||||||
+ 0.5);
|
+ 0.5);
|
||||||
|
|
||||||
if (xp) {
|
if (xp) {
|
||||||
|
@ -586,6 +591,7 @@ label_expose_event_cb (GtkLabel *label,
|
||||||
gint x, y;
|
gint x, y;
|
||||||
GdkColor color;
|
GdkColor color;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
GdkWindow *window;
|
||||||
GdkGC *gc;
|
GdkGC *gc;
|
||||||
|
|
||||||
color.red = 0;
|
color.red = 0;
|
||||||
|
@ -596,28 +602,30 @@ label_expose_event_cb (GtkLabel *label,
|
||||||
get_layout_location (label, &x, &y);
|
get_layout_location (label, &x, &y);
|
||||||
|
|
||||||
widget = GTK_WIDGET (label);
|
widget = GTK_WIDGET (label);
|
||||||
gc = gdk_gc_new (widget->window);
|
window = gtk_widget_get_window (widget);
|
||||||
|
|
||||||
|
gc = gdk_gc_new (window);
|
||||||
gdk_gc_set_rgb_fg_color (gc, &color);
|
gdk_gc_set_rgb_fg_color (gc, &color);
|
||||||
gdk_gc_set_clip_rectangle (gc, &event->area);
|
gdk_gc_set_clip_rectangle (gc, &event->area);
|
||||||
|
|
||||||
gdk_draw_layout_with_colors (widget->window,
|
gdk_draw_layout_with_colors (window,
|
||||||
gc,
|
gc,
|
||||||
x + 1,
|
x + 1,
|
||||||
y + 1,
|
y + 1,
|
||||||
label->layout,
|
gtk_label_get_layout (label),
|
||||||
&color,
|
&color,
|
||||||
NULL);
|
NULL);
|
||||||
g_object_unref (gc);
|
g_object_unref (gc);
|
||||||
|
|
||||||
gtk_paint_layout (widget->style,
|
gtk_paint_layout (gtk_widget_get_style (widget),
|
||||||
widget->window,
|
window,
|
||||||
gtk_widget_get_state (widget),
|
gtk_widget_get_state (widget),
|
||||||
FALSE,
|
FALSE,
|
||||||
&event->area,
|
&event->area,
|
||||||
widget,
|
widget,
|
||||||
"label",
|
"label",
|
||||||
x, y,
|
x, y,
|
||||||
label->layout);
|
gtk_label_get_layout (label));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ window_expose_event (GtkWidget *widget,
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
|
||||||
context = gdk_cairo_create (widget->window);
|
context = gdk_cairo_create (gtk_widget_get_window (widget));
|
||||||
|
|
||||||
cairo_set_operator (context, CAIRO_OPERATOR_SOURCE);
|
cairo_set_operator (context, CAIRO_OPERATOR_SOURCE);
|
||||||
gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
|
gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
|
||||||
|
@ -200,7 +200,7 @@ set_pixmap_background (GtkWidget *window)
|
||||||
|
|
||||||
g_object_unref (tile_pixbuf);
|
g_object_unref (tile_pixbuf);
|
||||||
|
|
||||||
pixmap = gdk_pixmap_new (GTK_WIDGET (window)->window,
|
pixmap = gdk_pixmap_new (gtk_widget_get_window (window),
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
-1);
|
-1);
|
||||||
|
@ -220,7 +220,7 @@ set_pixmap_background (GtkWidget *window)
|
||||||
|
|
||||||
g_object_unref (tmp_pixbuf);
|
g_object_unref (tmp_pixbuf);
|
||||||
|
|
||||||
gdk_window_set_back_pixmap (window->window, pixmap, FALSE);
|
gdk_window_set_back_pixmap (gtk_widget_get_window (window), pixmap, FALSE);
|
||||||
g_object_unref (pixmap);
|
g_object_unref (pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -334,7 +334,7 @@ break_window_map_event_cb (GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
DrWright *dr)
|
DrWright *dr)
|
||||||
{
|
{
|
||||||
grab_keyboard_on_window (dr->break_window->window, gtk_get_current_event_time ());
|
grab_keyboard_on_window (gtk_widget_get_window (dr->break_window), gtk_get_current_event_time ());
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue