~ubuntu-branches/ubuntu/hardy/gedit/hardy-proposed

« back to all changes in this revision

Viewing changes to gedit/gedit-notebook.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2006-07-11 14:06:41 UTC
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: james.westby@ubuntu.com-20060711140641-9ale6eu5anm0iftf
Tags: upstream-2.15.4
ImportĀ upstreamĀ versionĀ 2.15.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
780
780
        g_signal_emit (notebook, signals[TAB_CLOSE_REQUEST], 0, tab);
781
781
}
782
782
 
 
783
static void
 
784
tab_label_style_set_cb (GtkWidget *hbox,
 
785
                        GtkStyle *previous_style,
 
786
                        gpointer user_data)
 
787
{
 
788
        GtkWidget *button;
 
789
        gint h, w;
 
790
 
 
791
        gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (hbox),
 
792
                                           GTK_ICON_SIZE_MENU, &w, &h);
 
793
 
 
794
        button = g_object_get_data (G_OBJECT (hbox), "close-button");
 
795
        gtk_widget_set_size_request (button, w + 2, h + 2);
 
796
}
 
797
 
783
798
static GtkWidget *
784
799
build_tab_label (GeditNotebook *nb, 
785
800
                 GeditTab      *tab)
787
802
        GtkWidget *hbox, *label_hbox, *label_ebox;
788
803
        GtkWidget *label, *dummy_label;
789
804
        GtkWidget *close_button;
790
 
        GtkSettings *settings;
791
 
        gint w, h;
 
805
        GtkRcStyle *rcstyle;
792
806
        GtkWidget *image;
793
807
        GtkWidget *spinner;
794
808
        GtkWidget *icon;
795
809
 
796
 
        hbox = gtk_hbox_new (FALSE, 0);
 
810
        hbox = gtk_hbox_new (FALSE, 4);
797
811
 
798
812
        label_ebox = gtk_event_box_new ();
799
813
        gtk_event_box_set_visible_window (GTK_EVENT_BOX (label_ebox), FALSE);
800
814
        gtk_box_pack_start (GTK_BOX (hbox), label_ebox, TRUE, TRUE, 0);
801
815
 
802
 
        label_hbox = gtk_hbox_new (FALSE, 0);
 
816
        label_hbox = gtk_hbox_new (FALSE, 4);
803
817
        gtk_container_add (GTK_CONTAINER (label_ebox), label_hbox);
804
818
 
805
819
        /* setup close button */
809
823
        /* don't allow focus on the close button */
810
824
        gtk_button_set_focus_on_click (GTK_BUTTON (close_button), FALSE);
811
825
 
812
 
        /* fetch the size of an icon */
813
 
        settings = gtk_widget_get_settings (GTK_WIDGET (tab));
814
 
        gtk_icon_size_lookup_for_settings (settings,
815
 
                                           GTK_ICON_SIZE_MENU,
816
 
                                           &w, &h);
817
 
        image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
818
 
        gtk_widget_set_size_request (close_button, w + 2, h + 2);
 
826
        /* make it as small as possible */
 
827
        rcstyle = gtk_rc_style_new ();
 
828
        rcstyle->xthickness = rcstyle->ythickness = 0;
 
829
        gtk_widget_modify_style (close_button, rcstyle);
 
830
        gtk_rc_style_unref (rcstyle),
 
831
 
 
832
        image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
 
833
                                          GTK_ICON_SIZE_MENU);
819
834
        gtk_container_add (GTK_CONTAINER (close_button), image);
820
835
        gtk_box_pack_start (GTK_BOX (hbox), close_button, FALSE, FALSE, 0);
821
836
 
822
837
        gedit_tooltips_set_tip (nb->priv->title_tips, close_button,
823
838
                              _("Close document"), NULL);
824
839
 
825
 
        g_signal_connect (G_OBJECT (close_button), "clicked",
826
 
                          G_CALLBACK (close_button_clicked_cb),
827
 
                          tab);
 
840
        g_signal_connect (close_button,
 
841
                          "clicked",
 
842
                          G_CALLBACK (close_button_clicked_cb),
 
843
                          tab);
828
844
 
829
845
        /* setup spinner */
830
846
        spinner = gedit_spinner_new ();
836
852
        gtk_box_pack_start (GTK_BOX (label_hbox), icon, FALSE, FALSE, 0);
837
853
        
838
854
        /* setup label */
839
 
        label = gtk_label_new ("");
 
855
        label = gtk_label_new ("");
840
856
        gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
841
 
        gtk_misc_set_padding (GTK_MISC (label), 2, 0);
 
857
        gtk_misc_set_padding (GTK_MISC (label), 0, 0);
842
858
        gtk_box_pack_start (GTK_BOX (label_hbox), label, FALSE, FALSE, 0);
843
859
 
844
860
        dummy_label = gtk_label_new ("");
845
861
        gtk_box_pack_start (GTK_BOX (label_hbox), dummy_label, TRUE, TRUE, 0);
846
862
        
 
863
        /* Set minimal size */
 
864
        g_signal_connect (hbox, "style-set",
 
865
                          G_CALLBACK (tab_label_style_set_cb), NULL);
 
866
        
847
867
        gtk_widget_show (hbox);
848
868
        gtk_widget_show (label_ebox);
849
869
        gtk_widget_show (label_hbox);