[frogr] More cleanup: unified callbacks for toolbar buttons
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] More cleanup: unified callbacks for toolbar buttons
- Date: Sun, 24 Apr 2011 06:40:34 +0000 (UTC)
commit 0b2f51728d9499d0cb21cc57c26fdeb4b6d3273c
Author: Mario Sanchez Prada <msanchez igalia com>
Date: Sat Apr 23 20:40:48 2011 +0200
More cleanup: unified callbacks for toolbar buttons
data/gtkbuilder/frogr-main-view.xml | 6 +++---
src/frogr-main-view.c | 31 +++++++++----------------------
2 files changed, 12 insertions(+), 25 deletions(-)
---
diff --git a/data/gtkbuilder/frogr-main-view.xml b/data/gtkbuilder/frogr-main-view.xml
index 54e404c..144cad1 100644
--- a/data/gtkbuilder/frogr-main-view.xml
+++ b/data/gtkbuilder/frogr-main-view.xml
@@ -17,7 +17,7 @@
<property name="label" translatable="yes">Add</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-add</property>
- <signal name="clicked" handler="_on_add_button_clicked" swapped="no"/>
+ <signal name="clicked" handler="_on_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -31,7 +31,7 @@
<property name="label" translatable="yes">Remove</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-remove</property>
- <signal name="clicked" handler="_on_remove_button_clicked" swapped="no"/>
+ <signal name="clicked" handler="_on_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -45,7 +45,7 @@
<property name="label" translatable="yes">Upload</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-go-up</property>
- <signal name="clicked" handler="_on_upload_button_clicked" swapped="no"/>
+ <signal name="clicked" handler="_on_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index 6285de8..86aa32b 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -153,10 +153,6 @@ static void _on_icon_view_drag_data_received (GtkWidget *widget,
guint info, guint time,
gpointer data);
-void _on_add_button_clicked (GtkButton *widget, gpointer data);
-void _on_remove_button_clicked (GtkButton *widget, gpointer data);
-void _on_upload_button_clicked (GtkButton *widget, gpointer data);
-
gboolean _on_icon_view_key_press_event (GtkWidget *widget,
GdkEventKey *event,
gpointer data);
@@ -716,27 +712,18 @@ _on_icon_view_drag_data_received (GtkWidget *widget,
}
void
-_on_add_button_clicked (GtkButton *widget,
- gpointer data)
+_on_button_clicked (GtkButton *widget, gpointer data)
{
FrogrMainView *mainview = FROGR_MAIN_VIEW (data);
- _add_pictures_dialog (mainview);
-}
-
-void
-_on_remove_button_clicked (GtkButton *widget,
- gpointer data)
-{
- FrogrMainView *mainview = FROGR_MAIN_VIEW (data);
- _remove_selected_pictures (mainview);
-}
+ FrogrMainViewPrivate *priv = NULL;
-void
-_on_upload_button_clicked (GtkButton *widget,
- gpointer data)
-{
- FrogrMainView *mainview = FROGR_MAIN_VIEW (data);
- _upload_pictures (mainview);
+ priv = FROGR_MAIN_VIEW_GET_PRIVATE (data);
+ if (GTK_WIDGET (widget) == priv->add_button)
+ _add_pictures_dialog (mainview);
+ else if (GTK_WIDGET (widget) == priv->remove_button)
+ _remove_selected_pictures (mainview);
+ else if (GTK_WIDGET (widget) == priv->upload_button)
+ _upload_pictures (mainview);
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]