2 * arch-tag: Implementation of Rhythmbox Glade XML utility functions
4 * Copyright (C) 2002 Jorn Baayen
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include "rb-glade-helpers.h"
27 #include "rb-file-helpers.h"
29 static void glade_signal_connect_func (const gchar
*cb_name
, GObject
*obj
,
30 const gchar
*signal_name
, const gchar
*signal_data
,
31 GObject
*conn_obj
, gboolean conn_after
,
35 rb_glade_xml_new (const char *file
,
41 xml
= glade_xml_new (rb_file (file
), root
, NULL
);
43 glade_xml_signal_autoconnect_full (xml
,
44 (GladeXMLConnectFunc
) glade_signal_connect_func
,
51 glade_signal_connect_func (const gchar
*cb_name
, GObject
*obj
,
52 const gchar
*signal_name
, const gchar
*signal_data
,
53 GObject
*conn_obj
, gboolean conn_after
,
56 /** Module with all the symbols of the program */
57 static GModule
*mod_self
= NULL
;
58 gpointer handler_func
;
60 /* initialize gmodule */
63 mod_self
= g_module_open (NULL
, 0);
64 g_assert (mod_self
!= NULL
);
67 if (g_module_symbol (mod_self
, cb_name
, &handler_func
))
74 g_signal_connect_object
76 handler_func
, conn_obj
,
81 g_signal_connect_object
83 handler_func
, conn_obj
,
89 /* no conn_obj; use standard connect */
96 g_signal_connect_after
110 g_warning("callback function not found: %s", cb_name
);
115 rb_glade_boldify_label (GladeXML
*xml
, const char *name
)
119 widget
= glade_xml_get_widget (xml
, name
);
121 if (widget
== NULL
) {
122 g_warning ("widget '%s' not found", name
);
126 /* this way is probably better, but for some reason doesn't work with
127 * labels with mnemonics.
129 static PangoAttrList *pattrlist = NULL;
131 if (pattrlist == NULL) {
132 PangoAttribute *attr;
134 pattrlist = pango_attr_list_new ();
135 attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
136 attr->start_index = 0;
137 attr->end_index = G_MAXINT;
138 pango_attr_list_insert (pattrlist, attr);
140 gtk_label_set_attributes (GTK_LABEL (widget), pattrlist);*/
143 str_final
= g_strdup_printf ("<b>%s</b>", gtk_label_get_label (GTK_LABEL (widget
)));
144 gtk_label_set_markup_with_mnemonic (GTK_LABEL (widget
), str_final
);
149 rb_combo_box_hyphen_separator_func (GtkTreeModel
*model
,
155 gtk_tree_model_get (model
, iter
, 0, &s
, -1);
160 return (strcmp (s
, "-") == 0);