[gedit-list] close buttons on tabs
- From: James Willcox <jwillcox cs indiana edu>
- To: Paolo Maggi <maggi athena polito it>
- Cc: gedit-list lists sourceforge net
- Subject: [gedit-list] close buttons on tabs
- Date: Sat Aug 24 17:19:21 2002
Paolo,
Here's a patch that adds close buttons on tabs. I would like to make
the buttons a bit smaller still, but didn't see an obvious way to do
it.....
Thanks,
James
? stamp-h1
? src/.gedit-mdi-child.c.swp
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gedit/ChangeLog,v
retrieving revision 1.372
diff -u -5 -t -r1.372 ChangeLog
--- ChangeLog 24 Aug 2002 16:09:22 -0000 1.372
+++ ChangeLog 25 Aug 2002 00:17:35 -0000
@@ -1,5 +1,9 @@
+2002-08-24 James Willcox <jwillcox gnome org>
+
+ * TODO: Updated
+
2002-08-24 Paolo Maggi <maggi athena polito it>
* configure.in: added plugins/indent/Makefile to AC_OUTPUT
2002-08-24 Paolo Maggi <maggi athena polito it>
Index: TODO
===================================================================
RCS file: /cvs/gnome/gedit/TODO,v
retrieving revision 1.154
diff -u -5 -t -r1.154 TODO
--- TODO 24 Aug 2002 15:46:19 -0000 1.154
+++ TODO 25 Aug 2002 00:17:36 -0000
@@ -37,11 +37,11 @@
Easy tasks
----------
[ ] Improving the time plugin (Resp: Paolo)
-[ ] Close button on the tabs, like in galeon (Resp: Paolo)
+[X] Close button on the tabs, like in galeon (James)
[ ] Improving preferences management in existing plugins (Resp: Paolo)
[A] Implementing an indent plugin (Assigned to Paolo)
Tasks for non developers
------------------------
@@ -49,6 +49,6 @@
[ ] Designing a new logo (Resp: Paolo)
[ ] Maintaining the web site (Resp: James Willcox)
[ ] Writing new taglists (Resp: Paolo)
[ ] Writing user documentation for plugins (Resp: Paolo)
[ ] Writing release notes when needed (Resp: Paolo)
-[ ] Testing tarballs (Resp: Paolo)
\ No newline at end of file
+[ ] Testing tarballs (Resp: Paolo)
Index: src/ChangeLog
===================================================================
RCS file: /cvs/gnome/gedit/src/ChangeLog,v
retrieving revision 1.465
diff -u -5 -t -r1.465 ChangeLog
--- src/ChangeLog 24 Aug 2002 16:00:39 -0000 1.465
+++ src/ChangeLog 25 Aug 2002 00:17:43 -0000
@@ -1,5 +1,11 @@
+2002-08-24 James Willcox <jwillcox cs indiana edu>
+
+ * gedit-mdi-child.c (gedit_mdi_child_set_label): New method,
+ overrides the one in bonobo-mdi. Adds close buttons to the notebook
+ tabs.
+
2002-08-24 Paolo Maggi <maggi athena polito it>
* gedit-file.c (gedit_file_revert_dialog): new function
(gedit_file_revert): ask the user if she really wants to revert the file
Index: src/gedit-mdi-child.c
===================================================================
RCS file: /cvs/gnome/gedit/src/gedit-mdi-child.c,v
retrieving revision 1.6
diff -u -5 -t -r1.6 gedit-mdi-child.c
--- src/gedit-mdi-child.c 14 May 2002 09:46:38 -0000 1.6
+++ src/gedit-mdi-child.c 25 Aug 2002 00:17:50 -0000
@@ -59,10 +59,14 @@
static void gedit_mdi_child_document_can_undo_redo_handler (GeditDocument *document,
gboolean can, GeditMDIChild* child);
static gchar* gedit_mdi_child_get_config_string (BonoboMDIChild *child, gpointer data);
+
+static GtkWidget * gedit_mdi_child_set_label (BonoboMDIChild *child,
+ GtkWidget *old_label,
+ gpointer data);
static BonoboMDIChildClass *parent_class = NULL;
static guint mdi_child_signals[LAST_SIGNAL] = { 0 };
@@ -130,10 +134,13 @@
BONOBO_MDI_CHILD_CLASS (klass)->create_view =
(BonoboMDIChildViewCreator)(gedit_mdi_child_create_view);
BONOBO_MDI_CHILD_CLASS (klass)->get_config_string =
(BonoboMDIChildConfigFunc)(gedit_mdi_child_get_config_string);
+
+ BONOBO_MDI_CHILD_CLASS (klass)->set_label =
+ (BonoboMDIChildLabelFunc)(gedit_mdi_child_set_label);
}
static void
gedit_mdi_child_init (GeditMDIChild *child)
{
@@ -350,6 +357,61 @@
g_return_val_if_fail (GEDIT_IS_MDI_CHILD (child), NULL);
c = GEDIT_MDI_CHILD (child);
return gedit_document_get_raw_uri (c->document);
+}
+
+static void
+gedit_mdi_child_tab_close_clicked (GtkWidget *button, BonoboMDIChild *child)
+{
+ BonoboMDI *mdi;
+
+ mdi = BONOBO_MDI (bonobo_mdi_child_get_parent (child));
+
+ bonobo_mdi_remove_child (BONOBO_MDI (mdi), child, FALSE);
+}
+
+static GtkWidget *
+gedit_mdi_child_set_label (BonoboMDIChild *child, GtkWidget *old_hbox,
+ gpointer data)
+{
+ GtkWidget *ret;
+ gchar *name = bonobo_mdi_child_get_name (child);
+
+ if (old_hbox != NULL) {
+ GtkWidget *label = g_object_get_data (G_OBJECT (old_hbox),
+ "label");
+ gtk_label_set_text (GTK_LABEL (label), name);
+ ret = old_hbox;
+ } else {
+ GtkWidget *hbox;
+ GtkWidget *label;
+ GtkWidget *button;
+ GtkWidget *image;
+
+ label = gtk_label_new (name);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+
+ button = gtk_button_new ();
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (gedit_mdi_child_tab_close_clicked),
+ child);
+ gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+ image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
+ GTK_ICON_SIZE_MENU);
+ gtk_container_add (GTK_CONTAINER (button), image);
+
+ hbox = gtk_hbox_new (FALSE, 2);
+ gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+
+ g_object_set_data (G_OBJECT (hbox), "label", label);
+
+ gtk_widget_show_all (hbox);
+ ret = hbox;
+ }
+
+ g_free (name);
+
+ return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]