diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-01-27 14:10:55 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-01-27 14:10:55 +0000 |
commit | a2fa59532c361e128d181352d0c25743596f3b70 (patch) | |
tree | 4c66ca7830a1a0348fb67cb9c4211502616895c0 /gtk/gtkaboutdialog.c | |
parent | d5102464a36e1a99c5409ecb1735ecfe64ed34fc (diff) | |
download | gtk+-a2fa59532c361e128d181352d0c25743596f3b70.tar.gz |
Some visual tweaks to the about dialog, obey HIG spacing a bit more, add a
2005-01-27 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkaboutdialog.c: Some visual tweaks to the about dialog,
obey HIG spacing a bit more, add a hand cursor when over the
link button. (#163979, Jorn Baayen)
Diffstat (limited to 'gtk/gtkaboutdialog.c')
-rw-r--r-- | gtk/gtkaboutdialog.c | 74 |
1 files changed, 71 insertions, 3 deletions
diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c index f26b417aa1..5a3e983912 100644 --- a/gtk/gtkaboutdialog.c +++ b/gtk/gtkaboutdialog.c @@ -115,6 +115,11 @@ static void gtk_about_dialog_set_property (GObject guint prop_id, const GValue *value, GParamSpec *pspec); +static void gtk_about_dialog_style_set (GtkWidget *widget, + GtkStyle *previous_style); +static void dialog_style_set (GtkWidget *widget, + GtkStyle *previous_style, + gpointer data); static void update_name_version (GtkAboutDialog *about); static GtkIconSet * icon_set_new_from_pixbufs (GList *pixbufs); static void activate_url (GtkWidget *widget, @@ -181,6 +186,8 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass) object_class->finalize = gtk_about_dialog_finalize; + widget_class->style_set = gtk_about_dialog_style_set; + /** * GtkAboutDialog:name: * @@ -439,7 +446,6 @@ gtk_about_dialog_init (GtkAboutDialog *about) /* Widgets */ gtk_widget_push_composite_child (); vbox = gtk_vbox_new (FALSE, 8); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about)->vbox), vbox, TRUE, TRUE, 0); @@ -649,6 +655,37 @@ gtk_about_dialog_get_property (GObject *object, } } +static void +dialog_style_set (GtkWidget *widget, + GtkStyle *previous_style, + gpointer data) +{ + GtkDialog *dialog; + + dialog = GTK_DIALOG (widget); + + /* Override the style properties with HIG-compliant spacings. Ugh. + * http://developer.gnome.org/projects/gup/hig/1.0/layout.html#layout-dialogs + * http://developer.gnome.org/projects/gup/hig/1.0/windows.html#alert-spacing + */ + + gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox), 12); + gtk_box_set_spacing (GTK_BOX (dialog->vbox), 12); + + gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 0); + gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6); +} + +static void +gtk_about_dialog_style_set (GtkWidget *widget, + GtkStyle *previous_style) +{ + if (GTK_WIDGET_CLASS (gtk_about_dialog_parent_class)->style_set) + GTK_WIDGET_CLASS (gtk_about_dialog_parent_class)->style_set (widget, previous_style); + + dialog_style_set (widget, previous_style, NULL); +} + /** * gtk_about_dialog_get_name: * @about: a #GtkAboutDialog @@ -1533,6 +1570,27 @@ set_link_button_text (GtkWidget *about, g_free (link); } +static gboolean +link_button_enter (GtkWidget *widget, + GdkEventCrossing *event, + GtkAboutDialog *about) +{ + GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data; + gdk_window_set_cursor (widget->window, priv->hand_cursor); + + return FALSE; +} + +static gboolean +link_button_leave (GtkWidget *widget, + GdkEventCrossing *event, + GtkAboutDialog *about) +{ + gdk_window_set_cursor (widget->window, NULL); + + return FALSE; +} + static GtkWidget * create_link_button (GtkWidget *about, gchar *text, @@ -1550,6 +1608,10 @@ create_link_button (GtkWidget *about, set_link_button_text (about, button, text); g_signal_connect (button, "clicked", callback, data); + g_signal_connect (button, "enter_notify_event", + G_CALLBACK (link_button_enter), data); + g_signal_connect (button, "leave_notify_event", + G_CALLBACK (link_button_leave), data); return button; } @@ -1765,6 +1827,7 @@ add_credits_page (GtkAboutDialog *about, buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE); gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE); + gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 8); gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 8); @@ -1778,6 +1841,8 @@ add_credits_page (GtkAboutDialog *about, G_CALLBACK (credits_visibility_notify_event), about); sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), + GTK_SHADOW_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -1893,9 +1958,10 @@ display_credits_dialog (GtkWidget *button, g_signal_connect (dialog, "destroy", G_CALLBACK (gtk_widget_destroyed), &(priv->credits_dialog)); + g_signal_connect (dialog, "style_set", + G_CALLBACK (dialog_style_set), NULL); notebook = gtk_notebook_new (); - gtk_container_set_border_width (GTK_CONTAINER (notebook), 8); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE, TRUE, 0); if (priv->authors != NULL) @@ -1963,6 +2029,8 @@ display_license_dialog (GtkWidget *button, g_signal_connect (dialog, "destroy", G_CALLBACK (gtk_widget_destroyed), &(priv->license_dialog)); + g_signal_connect (dialog, "style_set", + G_CALLBACK (dialog_style_set), NULL); sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), @@ -1971,7 +2039,6 @@ display_license_dialog (GtkWidget *button, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); g_signal_connect (sw, "map", G_CALLBACK (set_policy), NULL); - gtk_container_set_border_width (GTK_CONTAINER (sw), 8); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), sw, TRUE, TRUE, 0); view = gtk_text_view_new (); @@ -1980,6 +2047,7 @@ display_license_dialog (GtkWidget *button, gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE); gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE); + gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 8); gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 8); |