[ekiga] Remove unused functions and fix indentation
- From: Eugen Dedu <ededu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Remove unused functions and fix indentation
- Date: Thu, 22 Jul 2010 22:48:42 +0000 (UTC)
commit c8c8c843986ebcf88e736398cad3d5cd5db81bc4
Author: Eugen Dedu <Eugen Dedu pu-pm univ-fcomte fr>
Date: Fri Jul 23 00:48:26 2010 +0200
Remove unused functions and fix indentation
lib/gui/gmmenuaddon.c | 291 ++++++++++++++++++++-----------------------------
lib/gui/gmmenuaddon.h | 40 +------
2 files changed, 122 insertions(+), 209 deletions(-)
---
diff --git a/lib/gui/gmmenuaddon.c b/lib/gui/gmmenuaddon.c
index b6aa64c..bec576a 100644
--- a/lib/gui/gmmenuaddon.c
+++ b/lib/gui/gmmenuaddon.c
@@ -27,7 +27,7 @@
/*
- * gtk_menu_extensions.c - description
+ * gtk_menu_extensions.c - description
* -------------------------------------
* begin : Mon Sep 29 2003, but based on older code
* copyright : (C) 2000-2006 by Damien Sandras
@@ -48,7 +48,7 @@
static void menus_have_icons_changed_nt (gpointer,
GmConfEntry *,
gpointer);
-
+
static gint popup_menu_callback (GtkWidget *,
GdkEventButton *,
gpointer);
@@ -73,13 +73,13 @@ menus_have_icons_changed_nt (G_GNUC_UNUSED gpointer cid,
gboolean show_icons = TRUE;
g_return_if_fail (gm_conf_entry_get_type (entry) == GM_CONF_BOOL && data);
-
+
show_icons = gm_conf_entry_get_bool (entry);
gtk_menu_show_icons (GTK_WIDGET (data), show_icons);
}
-/* DESCRIPTION : This callback is called when the user clicks on an
+/* DESCRIPTION : This callback is called when the user clicks on an
* event-box.
* BEHAVIOR : Displays the menu given as data if it was a right click.
* PRE : data != NULL.
@@ -93,7 +93,7 @@ popup_menu_callback (G_GNUC_UNUSED GtkWidget *widget,
GdkEventButton *event_button;
menu = GTK_MENU (data);
-
+
if (event->type == GDK_BUTTON_PRESS) {
event_button = (GdkEventButton *) event;
@@ -115,7 +115,7 @@ popup_menu_callback (G_GNUC_UNUSED GtkWidget *widget,
* PRE : If data is NULL, clears the statusbar, else displays data
* as message in the statusbar.
*/
-static void
+static void
menu_item_selected (GtkWidget *w,
gpointer data)
{
@@ -124,7 +124,7 @@ menu_item_selected (GtkWidget *w,
gint id = 0;
int len = 0;
int i = 0;
-
+
statusbar = (GtkWidget *) g_object_get_data (G_OBJECT (w), "statusbar");
if (!statusbar)
@@ -132,9 +132,9 @@ menu_item_selected (GtkWidget *w,
else {
id = gtk_statusbar_get_context_id (GTK_STATUSBAR (statusbar), "statusbar");
-
+
if (data) {
-
+
gtk_statusbar_push (GTK_STATUSBAR (statusbar), id, (gchar *) data);
}
else {
@@ -143,7 +143,7 @@ menu_item_selected (GtkWidget *w,
gtk_statusbar_remove_all (GTK_STATUSBAR (statusbar), id);
#else
len = g_slist_length ((GSList *) (GTK_STATUSBAR (statusbar)->messages));
-
+
for (i = 0 ; i < len ; i++)
gtk_statusbar_pop (GTK_STATUSBAR (statusbar), id);
#endif
@@ -160,13 +160,13 @@ menu_item_selected (GtkWidget *w,
static void
menu_widget_destroyed (G_GNUC_UNUSED GtkWidget *w,
gpointer data)
-{
+{
gm_conf_notifier_remove (data);
}
/* The public functions */
-void
+void
radio_menu_changed_cb (GtkWidget *widget,
gpointer data)
{
@@ -177,7 +177,6 @@ radio_menu_changed_cb (GtkWidget *widget,
g_return_if_fail (data != NULL);
-
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (widget));
group_last_pos = g_slist_length (group) - 1; /* If length 1, last pos is 0 */
@@ -187,9 +186,9 @@ radio_menu_changed_cb (GtkWidget *widget,
while (group) {
- if (group->data == widget)
- break;
-
+ if (group->data == widget)
+ break;
+
active++;
group = g_slist_next (group);
}
@@ -199,56 +198,18 @@ radio_menu_changed_cb (GtkWidget *widget,
}
-void
-toggle_menu_changed_cb (GtkWidget *widget,
+void
+toggle_menu_changed_cb (GtkWidget *widget,
gpointer data)
{
g_return_if_fail (data != NULL);
-
- gm_conf_set_bool ((gchar *) data,
- gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)));
-}
-
-
-void
-menu_toggle_changed_nt (G_GNUC_UNUSED gpointer id,
- GmConfEntry *entry,
- gpointer data)
-{
- GtkWidget *e = NULL;
-
- g_return_if_fail (data != NULL);
-
- if (gm_conf_entry_get_type (entry) == GM_CONF_BOOL) {
-
- e = GTK_WIDGET (data);
-
- /* We set the new value for the widget */
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (e), gm_conf_entry_get_bool (entry));
-
- gtk_widget_queue_draw (GTK_WIDGET (e));
- }
+ gm_conf_set_bool ((gchar *) data,
+ gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)));
}
void
-radio_menu_changed_nt (G_GNUC_UNUSED gpointer id,
- GmConfEntry *entry,
- gpointer data)
-{
- g_return_if_fail (data != NULL);
-
-
- if (gm_conf_entry_get_type (entry) == GM_CONF_INT) {
-
- gtk_radio_menu_select_with_widget (GTK_WIDGET (data),
- gm_conf_entry_get_int (entry));
- }
-}
-
-
-void
gtk_build_menu (GtkWidget *menubar,
MenuEntry *menu,
GtkAccelGroup *accel,
@@ -260,7 +221,7 @@ gtk_build_menu (GtkWidget *menubar,
GtkStockItem item;
GSList *group = NULL;
-
+
int i = 0;
gchar *menu_name = NULL;
@@ -269,12 +230,12 @@ gtk_build_menu (GtkWidget *menubar,
show_icons =
gm_conf_get_bool ("/desktop/gnome/interface/menus_have_icons");
-
+
while (menu [i].type != MENU_END) {
GSList *new_group = NULL;
-
- if (menu [i].type != MENU_RADIO_ENTRY)
+
+ if (menu [i].type != MENU_RADIO_ENTRY)
group = NULL;
if (menu [i].stock_id && !menu [i].stock_is_theme && !menu [i].name) {
@@ -284,61 +245,59 @@ gtk_build_menu (GtkWidget *menubar,
else
menu_name = g_strdup (menu [i].name);
}
- else
+ else
menu_name = g_strdup (menu [i].name);
if (menu_name) {
- if (menu [i].type == MENU_ENTRY
- || menu [i].type == MENU_SUBMENU_NEW
- || menu [i].type == MENU_NEW)
- menu [i].widget =
- gtk_image_menu_item_new_with_mnemonic (menu_name);
+ if (menu [i].type == MENU_ENTRY
+ || menu [i].type == MENU_SUBMENU_NEW
+ || menu [i].type == MENU_NEW)
+ menu [i].widget = gtk_image_menu_item_new_with_mnemonic (menu_name);
else if (menu [i].type == MENU_TOGGLE_ENTRY) {
-
- menu [i].widget =
- gtk_check_menu_item_new_with_mnemonic (menu_name);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu [i].widget), menu [i].enabled);
- gtk_widget_queue_draw (menu [i].widget);
+
+ menu [i].widget = gtk_check_menu_item_new_with_mnemonic (menu_name);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu [i].widget),
+ menu [i].enabled);
+ gtk_widget_queue_draw (menu [i].widget);
}
else if (menu [i].type == MENU_RADIO_ENTRY) {
- if (group == NULL)
- group = new_group;
-
- menu [i].widget =
- gtk_radio_menu_item_new_with_mnemonic (group,
- menu_name);
+ if (group == NULL)
+ group = new_group;
+
+ menu [i].widget = gtk_radio_menu_item_new_with_mnemonic (group,
+ menu_name);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu [i].widget), menu [i].enabled);
- gtk_widget_queue_draw (menu [i].widget);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu [i].widget),
+ menu [i].enabled);
+ gtk_widget_queue_draw (menu [i].widget);
- group =
- gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu[i].widget));
+ group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu[i].widget));
}
if (menu [i].stock_id && show_icons) {
- if (menu [i].stock_is_theme)
- image = gtk_image_new_from_icon_name(menu [i].stock_id,
- GTK_ICON_SIZE_MENU);
- else
- image = gtk_image_new_from_stock (menu [i].stock_id,
- GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu[i].widget),
- image);
- gtk_widget_show (image);
+ if (menu [i].stock_is_theme)
+ image = gtk_image_new_from_icon_name(menu [i].stock_id,
+ GTK_ICON_SIZE_MENU);
+ else
+ image = gtk_image_new_from_stock (menu [i].stock_id,
+ GTK_ICON_SIZE_MENU);
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu[i].widget),
+ image);
+ gtk_widget_show (image);
}
if (menu [i].accel && accel)
{
/* if ((menu [i].accel == GDK_F1) || (menu [i].accel == GDK_F11))
- gtk_widget_add_accelerator (menu [i].widget, "activate",
- accel, menu [i].accel,
+ gtk_widget_add_accelerator (menu [i].widget, "activate",
+ accel, menu [i].accel,
0, GTK_ACCEL_VISIBLE);
else
- gtk_widget_add_accelerator (menu [i].widget, "activate",
- accel, menu [i].accel,
+ gtk_widget_add_accelerator (menu [i].widget, "activate",
+ accel, menu [i].accel,
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
*/
switch (menu [i].accel) {
@@ -349,16 +308,16 @@ gtk_build_menu (GtkWidget *menubar,
case GDK_t:
case GDK_m:
case GDK_p:
- gtk_widget_add_accelerator (menu [i].widget, "activate",
+ gtk_widget_add_accelerator (menu [i].widget, "activate",
accel, menu [i].accel,
0, GTK_ACCEL_VISIBLE);
- break;
+ break;
default:
- gtk_widget_add_accelerator (menu [i].widget, "activate",
+ gtk_widget_add_accelerator (menu [i].widget, "activate",
accel, menu [i].accel,
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
- break;
- }
+ break;
+ }
}
if (menu [i].func) {
@@ -367,7 +326,7 @@ gtk_build_menu (GtkWidget *menubar,
g_signal_connect_data (G_OBJECT (menu [i].widget),
"activate", menu [i].func,
menu [i].data,
- (GClosureNotify) menu [i].clofunc,
+ (GClosureNotify) menu [i].clofunc,
(GConnectFlags) G_CONNECT_AFTER);
}
else {
@@ -380,60 +339,58 @@ gtk_build_menu (GtkWidget *menubar,
g_object_set_data (G_OBJECT (menu [i].widget),
"statusbar", statusbar);
g_signal_connect (G_OBJECT (menu [i].widget),
- "select", G_CALLBACK (menu_item_selected),
+ "select", G_CALLBACK (menu_item_selected),
(gpointer) menu [i].tooltip);
g_signal_connect (G_OBJECT (menu [i].widget),
- "deselect", G_CALLBACK (menu_item_selected),
+ "deselect", G_CALLBACK (menu_item_selected),
NULL);
}
g_free (menu_name);
if (menu [i].type == MENU_SEP) {
- menu [i].widget =
- gtk_separator_menu_item_new ();
+ menu [i].widget = gtk_separator_menu_item_new ();
if (old_menu) {
- menu_widget = old_menu;
- old_menu = NULL;
+ menu_widget = old_menu;
+ old_menu = NULL;
}
- }
+ }
if (menu [i].type == MENU_NEW
- || menu [i].type == MENU_SUBMENU_NEW) {
-
- if (menu [i].type == MENU_SUBMENU_NEW)
- old_menu = menu_widget;
+ || menu [i].type == MENU_SUBMENU_NEW) {
+
+ if (menu [i].type == MENU_SUBMENU_NEW)
+ old_menu = menu_widget;
menu_widget = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu [i].widget),
- menu_widget);
+ menu_widget);
if (menu [i].type == MENU_NEW)
- gtk_menu_shell_append (GTK_MENU_SHELL (menubar),
- menu [i].widget);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menubar),
+ menu [i].widget);
else
- gtk_menu_shell_append (GTK_MENU_SHELL (old_menu),
- menu [i].widget);
+ gtk_menu_shell_append (GTK_MENU_SHELL (old_menu),
+ menu [i].widget);
}
else
gtk_menu_shell_append (GTK_MENU_SHELL (menu_widget),
- menu [i].widget);
+ menu [i].widget);
-
if (menu [i].id) {
-
+
if (menu [i].type != MENU_SUBMENU_NEW)
- g_object_set_data (G_OBJECT (menubar), menu [i].id,
- menu [i].widget);
+ g_object_set_data (G_OBJECT (menubar), menu [i].id,
+ menu [i].widget);
else
- g_object_set_data (G_OBJECT (menubar), menu [i].id,
- menu_widget);
+ g_object_set_data (G_OBJECT (menubar), menu [i].id,
+ menu_widget);
}
-
+
if (!menu [i].sensitive)
gtk_widget_set_sensitive (GTK_WIDGET (menu [i].widget), FALSE);
-
+
gtk_widget_show (menu [i].widget);
i++;
@@ -442,7 +399,7 @@ gtk_build_menu (GtkWidget *menubar,
g_object_set_data (G_OBJECT (menubar), "menu_entry", menu);
id = gm_conf_notifier_add ("/desktop/gnome/interface/menus_have_icons",
- menus_have_icons_changed_nt,
+ menus_have_icons_changed_nt,
menubar);
g_signal_connect (G_OBJECT (menubar), "destroy",
@@ -464,7 +421,7 @@ gtk_build_popup_menu (GtkWidget *widget,
if (widget) {
g_signal_connect (G_OBJECT (widget), "button_press_event",
- G_CALLBACK (popup_menu_callback),
+ G_CALLBACK (popup_menu_callback),
(gpointer) popup_menu_widget);
gtk_widget_add_events (widget, GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK);
@@ -485,7 +442,7 @@ gtk_menu_set_sensitive (GtkWidget *menu,
menu_item = (GtkWidget *) g_object_get_data (G_OBJECT (menu), id);
- if (menu_item)
+ if (menu_item)
gtk_widget_set_sensitive (GTK_WIDGET (menu_item), sensitive);
}
@@ -499,7 +456,7 @@ gtk_menu_section_set_sensitive (GtkWidget *menu,
MenuEntry *menu_entry = NULL;
int i = 0;
-
+
g_return_if_fail (menu != NULL && id != NULL);
menu_item = (GtkWidget *) g_object_get_data (G_OBJECT (menu), id);
@@ -515,7 +472,7 @@ gtk_menu_section_set_sensitive (GtkWidget *menu,
&& menu_entry [i].type != MENU_SEP
&& menu_entry [i].type != MENU_NEW
&& menu_entry [i].type != MENU_SUBMENU_NEW) {
-
+
gtk_widget_set_sensitive (GTK_WIDGET (menu_entry [i].widget),
sensitive);
i++;
@@ -535,16 +492,6 @@ gtk_menu_get_widget (GtkWidget *menu,
void
-gtk_toggle_menu_enable (GtkWidget *e,
- gboolean show)
-{
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (e), show);
-
- gtk_widget_queue_draw (GTK_WIDGET (e));
-}
-
-
-void
gtk_radio_menu_select_with_id (GtkWidget *menu,
const gchar *id,
int active)
@@ -555,24 +502,23 @@ gtk_radio_menu_select_with_id (GtkWidget *menu,
int group_last_pos = 0;
int i = 0;
-
+
widget = gtk_menu_get_widget (menu, id);
if (!widget)
return;
-
+
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (widget));
- group_last_pos = g_slist_length (group) - 1; /* If length 1,
- last pos is 0 */
+ group_last_pos = g_slist_length (group) - 1; /* If length 1, last pos is 0 */
while (group) {
if (gtk_widget_is_sensitive (GTK_WIDGET (group->data)))
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (group->data), (i == group_last_pos - active));
else
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (group->data), FALSE);
-
+
gtk_widget_queue_draw (GTK_WIDGET (group->data));
-
+
group = g_slist_next (group);
i++;
}
@@ -587,17 +533,16 @@ gtk_radio_menu_select_with_widget (GtkWidget *widget,
int group_last_pos = 0;
int i = 0;
-
+
g_return_if_fail (widget != NULL);
-
+
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (widget));
- group_last_pos = g_slist_length (group) - 1; /* If length 1,
- last pos is 0 */
+ group_last_pos = g_slist_length (group) - 1; /* If length 1, last pos is 0 */
while (group) {
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (group->data), (i == group_last_pos - active));
gtk_widget_queue_draw (GTK_WIDGET (group->data));
-
+
group = g_slist_next (group);
i++;
}
@@ -610,7 +555,7 @@ gtk_menu_show_icons (GtkWidget *menu, gboolean show_icons)
MenuEntry *menu_entry = NULL;
GtkWidget *image = NULL;
int i = 0;
-
+
menu_entry = (MenuEntry *) g_object_get_data (G_OBJECT (menu), "menu_entry");
while (menu_entry && menu_entry [i].type != MENU_END) {
@@ -621,27 +566,27 @@ gtk_menu_show_icons (GtkWidget *menu, gboolean show_icons)
if (show_icons) {
- if (!image) {
-
- if (menu_entry [i].stock_is_theme)
- image = gtk_image_new_from_icon_name(menu_entry [i].stock_id,
- GTK_ICON_SIZE_MENU);
- else
- image = gtk_image_new_from_stock (menu_entry [i].stock_id,
- GTK_ICON_SIZE_MENU);
- gtk_widget_show (image);
-
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_entry [i].widget), image);
- }
- else
- gtk_widget_show (image);
+ if (!image) {
+
+ if (menu_entry [i].stock_is_theme)
+ image = gtk_image_new_from_icon_name(menu_entry [i].stock_id,
+ GTK_ICON_SIZE_MENU);
+ else
+ image = gtk_image_new_from_stock (menu_entry [i].stock_id,
+ GTK_ICON_SIZE_MENU);
+ gtk_widget_show (image);
+
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_entry [i].widget), image);
+ }
+ else
+ gtk_widget_show (image);
}
else
- if (image)
- gtk_widget_hide (image);
-
+ if (image)
+ gtk_widget_hide (image);
+
}
-
+
i++;
- }
+ }
}
diff --git a/lib/gui/gmmenuaddon.h b/lib/gui/gmmenuaddon.h
index f432f1b..6319075 100644
--- a/lib/gui/gmmenuaddon.h
+++ b/lib/gui/gmmenuaddon.h
@@ -27,7 +27,7 @@
/*
- * gtk_menu_extensions.h - description
+ * gtk_menu_extensions.h - description
* -------------------------------------
* begin : Mon Sep 29 2003, but based on older code
* copyright : (C) 2000-2006 by Damien Sandras
@@ -107,7 +107,7 @@ typedef struct _MenuEntry {
{NULL, NULL, NULL, NULL, FALSE, 0, MENU_END, NULL, NULL, NULL, NULL, TRUE, TRUE}
-/* DESCRIPTION : This callback is called when the user
+/* DESCRIPTION : This callback is called when the user
* selects a different option in a radio menu.
* BEHAVIOR : Sets the config key.
* PRE : data is the config key.
@@ -120,34 +120,10 @@ void radio_menu_changed_cb (GtkWidget *,
* BEHAVIOR : Updates the config key given as parameter.
* PRE : data is the key.
*/
-void toggle_menu_changed_cb (GtkWidget *,
+void toggle_menu_changed_cb (GtkWidget *,
gpointer);
-/* DESCRIPTION : Generic notifiers for toggles in the menu.
- * This callback is called when a specific key of
- * the config database associated with a toggle changes, this
- * only updates the toggle in the menu.
- * BEHAVIOR : It only updates the widget.
- * PRE : The toggle menu item.
- */
-void menu_toggle_changed_nt (gpointer,
- GmConfEntry *,
- gpointer);
-
-
-/* DESCRIPTION : Notifiers for radios menu.
- * This callback is called when a specific key of
- * the config database associated with a radio menu changes,
- * this only updates the radio in the menu.
- * BEHAVIOR : It updates the widget.
- * PRE : One of the GtkCheckMenuItem of the radio menu.
- */
-void radio_menu_changed_nt (gpointer,
- GmConfEntry *,
- gpointer);
-
-
/* DESCRIPTION : /
* BEHAVIOR : Change the sensitivity of a whole Menu section given the
* Menu widget, the identifier of one of the first Menu item
@@ -183,7 +159,7 @@ GtkWidget *gtk_menu_get_widget (GtkWidget *,
/* DESCRIPTION : /
* BEHAVIOR : Builds a menu given a first menu, a structure, an
* AccelGroup and a possible GtkStatusBar where to push
- * the tooltips.
+ * the tooltips.
* PRE : /
*/
void gtk_build_menu (GtkWidget *,
@@ -203,14 +179,6 @@ GtkWidget *gtk_build_popup_menu (GtkWidget *,
/* DESCRIPTION : /
- * BEHAVIOR : Update the menu toggle with the new value.
- * PRE : /
- */
-void gtk_toggle_menu_enable (GtkWidget *,
- gboolean);
-
-
-/* DESCRIPTION : /
* BEHAVIOR : Selects the i th element in the radio menu identified
* by its ID without triggering the callbacks.
* PRE : /
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]