[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: x_pagesel.nw
User: cnieves
Date: 05/02/13 13:00:11
Log:
Remove "Discard page" button in the page manager.
Revision Changes Path
1.347 +12 -0 eda/geda/devel/gschem/ChangeLog
http://geda.seul.org/cgi-bin/viewcvs.cgi/eda/geda/devel//./ChangeLog.diff?r1=1.346&r2=1.347
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ChangeLog
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/ChangeLog,v
retrieving revision 1.346
retrieving revision 1.347
diff -u -b -r1.346 -r1.347
--- ChangeLog 12 Feb 2005 01:20:38 -0000 1.346
+++ ChangeLog 13 Feb 2005 18:00:09 -0000 1.347
@@ -1,3 +1,15 @@
+2005-02-13 Carlos Nieves Onega <cnieves@xxxxxxxxxx>
+
+ * include/prototype.h, noweb/x_pagesel.nw:
+ Commented out the code defining the "Discard page" button,
+ so it doesn't appear in the page manager.
+ Added new function "e_gtk_button_new_with_icon" which allows
+ to create a button with a given text, and an icon from the GTK
+ stock. Which is the right file to include such a generic function?
+ If texts like "Add page" are preferred in the buttons, then
+ there is only needed to comment a line, and uncomment another.
+ See the code of pagesel_init pagesel function.
+
2005-02-12 Carlos Nieves Onega <cnieves@xxxxxxxxxx>
* noweb/x_attribedit.nw, noweb/x_dialog.nw, noweb/x_fileselect.nw,
Log:
Remove "Discard page" button in the page manager.
Revision Changes Path
1.112 +1 -0 eda/geda/devel/gschem/include/prototype.h
http://geda.seul.org/cgi-bin/viewcvs.cgi/eda/geda/devel//./prototype.h.diff?r1=1.111&r2=1.112
(In the diff below, changes in quantity of whitespace are not shown.)
Index: prototype.h
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/include/prototype.h,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -b -r1.111 -r1.112
--- prototype.h 11 Feb 2005 21:48:57 -0000 1.111
+++ prototype.h 13 Feb 2005 18:00:10 -0000 1.112
@@ -860,6 +860,7 @@
void x_pagesel_open (TOPLEVEL *toplevel);
void x_pagesel_close (TOPLEVEL *toplevel);
void x_pagesel_update (TOPLEVEL *toplevel);
+GtkWidget *e_gtk_button_new_with_icon(const char *text, const char *stock);
/* x_preview.c */
void x_preview_update(TOPLEVEL *preview, const char *directory, const char *filename);
void x_preview_close(TOPLEVEL *w_current);
Modified: . x_pagesel.nw
Log:
Remove "Discard page" button in the page manager.
Revision Changes Path
1.10 +57 -9 eda/geda/devel/gschem/noweb/x_pagesel.nw
http://geda.seul.org/cgi-bin/viewcvs.cgi/eda/geda/devel//./x_pagesel.nw.diff?r1=1.9&r2=1.10
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_pagesel.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/x_pagesel.nw,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- x_pagesel.nw 12 Feb 2005 01:20:39 -0000 1.9
+++ x_pagesel.nw 13 Feb 2005 18:00:11 -0000 1.10
@@ -17,7 +17,7 @@
<<x_pagesel.c : x_pagesel_close()>>
<<x_pagesel.c : x_pagesel_update()>>
<<x_pagesel.c : x_pagesel_callback_response()>>
-
+<<x_pagesel.c : e_gtk_button_new_with_icon()>>
<<x_pagesel.c : Pagesel widget>>
@@ -326,13 +326,15 @@
, GTK_STOCK_CLOSE
#endif
},
- { "Discard Page", G_CALLBACK (pagesel_callback_button_discard_page)
-#ifndef HAS_GTK12
- , GTK_STOCK_CANCEL
-#endif
- },
+/* { "Discard Page", G_CALLBACK (pagesel_callback_button_discard_page) */
+/* #ifndef HAS_GTK12 */
+/* , GTK_STOCK_CANCEL */
+/* #endif */
+/* }, */
{ NULL, NULL
+#ifndef HAS_GTK12
, NULL
+#endif
} };
struct button_t *tmp;
@@ -432,9 +434,10 @@
"label", _(tmp->label),
NULL));
#else
- button = gtk_button_new_from_stock (tmp->stock_id);
- /* If the label is set after the button is created, the icon is lost */
- /* gtk_button_set_label (GTK_BUTTON(button), _(tmp->label)); */
+ button = gtk_button_new_from_stock(tmp->stock_id);
+ /* Comment the above line, and uncomment the line below if buttons with
+ the right label, like "Add page" or "Close page", are preferred */
+ /* button = e_gtk_button_new_with_icon(_(tmp->label), tmp->stock_id);*/
#endif
g_signal_connect (button,
"clicked",
@@ -682,3 +685,48 @@
}
@ %def pagesel_update
+
+@section Function @code{e_gtk_button_new_with_icon()}
+
+@defun e_gtk_button_new_with_icon text stock
+Create a gtk button with a custom label [[text]] and a stock icon [[stock]].
+[[text]]: The mnemonic text for the label.
+[[stock]]: The name of the stock item to get the icon from.
+
+Return value: The widget.
+
+Taken from evolution code:
+http://lists.ximian.com/archives/public/evolution-patches/2003-April/000088.html
+@end defun
+
+<<x_pagesel.c : e_gtk_button_new_with_icon()>>=
+GtkWidget *
+e_gtk_button_new_with_icon(const char *text, const char *stock)
+{
+ GtkWidget *button, *label;
+ GtkStockItem item;
+
+ button = gtk_button_new();
+ label = gtk_label_new_with_mnemonic(text);
+ gtk_label_set_mnemonic_widget((GtkLabel *)label, button);
+
+ if (gtk_stock_lookup(stock, &item)) {
+ GtkWidget *image, *hbox, *align;
+
+ image = gtk_image_new_from_stock(stock, GTK_ICON_SIZE_BUTTON);
+ hbox = gtk_hbox_new(FALSE, 2);
+ align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
+ gtk_box_pack_start((GtkBox *)hbox, image, FALSE, FALSE, 0);
+ gtk_box_pack_end((GtkBox *)hbox, label, FALSE, FALSE, 0);
+ gtk_container_add((GtkContainer *)align, hbox);
+ gtk_container_add((GtkContainer *)button, align);
+ gtk_widget_show_all(align);
+ } else {
+ gtk_misc_set_alignment((GtkMisc *)label, 0.5, 0.5);
+ gtk_container_add((GtkContainer *)button, label);
+ gtk_widget_show(label);
+ }
+
+ return button;
+}
+@ %def e_gtk_button_new_with_icon