Skip to content

Commit

Permalink
manually connect the signal handlers
Browse files Browse the repository at this point in the history
* configure.ac: we don't need exported symbols anymore
* src/lassi-prefs.c: manually connect the clicked signal of the
  add_button to its signal handler
* src/lassi-server.c: fix the order of initialization
* src/mango-lassi.ui: drop the signal handlers
  • Loading branch information
herzi committed Jul 1, 2010
1 parent 8331328 commit a304e0d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ PKG_PROG_PKG_CONFIG
#### D-Bus ####

PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.1.1 dbus-glib-1 ])
PKG_CHECK_MODULES(GTK, [ gtk+-2.0 gmodule-export-2.0 ])
PKG_CHECK_MODULES(GTK, [ gtk+-2.0 ])
PKG_CHECK_MODULES(XTEST, [ xtst x11 ])
PKG_CHECK_MODULES(AVAHI, [ avahi-glib avahi-client ])
PKG_CHECK_MODULES(AVAHI_UI, [ avahi-ui ])
Expand Down
25 changes: 18 additions & 7 deletions src/lassi-prefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ enum {

static void update_sensitive(LassiPrefsInfo *i);

void on_add_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
static void on_add_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
GtkWidget *d;

d = aui_service_dialog_new("Choose Desktop to add", GTK_WINDOW(i->dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, NULL);
Expand All @@ -43,7 +43,7 @@ void on_add_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
gtk_widget_destroy(d);
}

void on_remove_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
static void on_remove_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
GtkTreeIter iter;
GList* selected;
char *id;
Expand All @@ -63,7 +63,7 @@ void on_remove_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
g_list_free(selected);
}

void on_up_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
static void on_up_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
/* FIXME: memory management is broken; this function is _really_ leaky */
GtkTreeModel *model = GTK_TREE_MODEL(i->list_store); /* FIXME: remove local variable */
GtkTreeIter iter;
Expand Down Expand Up @@ -109,7 +109,7 @@ void on_up_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
g_list_free(selected);
}

void on_down_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
static void on_down_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
/* FIXME: memory management is broken; this function is _really_ leaky */
GtkTreeModel *model = GTK_TREE_MODEL(i->list_store); /* FIXME: remove local variable */
GtkTreeIter iter;
Expand Down Expand Up @@ -153,11 +153,11 @@ void on_down_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
g_list_free(selected);
}

void on_close_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
static void on_close_button_clicked(GtkButton *widget, LassiPrefsInfo *i) {
gtk_widget_hide(GTK_WIDGET(i->dialog));
}

void on_help_button_clicked(GtkButton *button, LassiPrefsInfo *i) {
static void on_help_button_clicked(GtkButton *button, LassiPrefsInfo *i) {
#if GTK_CHECK_VERSION(2,14,0)
lassi_help_open(gtk_widget_get_screen(GTK_WIDGET(button)), "mango-lassi", "preferences");
#endif
Expand Down Expand Up @@ -270,7 +270,18 @@ int lassi_prefs_init(LassiPrefsInfo *i, LassiServer *server) {
i->remove_button = GTK_WIDGET(gtk_builder_get_object(i->builder, "remove_button"));
i->icon_view = GTK_WIDGET(gtk_builder_get_object(i->builder, "tree_view"));

gtk_builder_connect_signals(i->builder, i);
g_signal_connect(i->add_button, "clicked",
G_CALLBACK(on_add_button_clicked), i);
g_signal_connect(gtk_builder_get_object(i->builder, "close_button"), "clicked",
G_CALLBACK(on_close_button_clicked), i);
g_signal_connect(gtk_builder_get_object(i->builder, "help_button"), "clicked",
G_CALLBACK(on_help_button_clicked), i);
g_signal_connect(i->down_button, "clicked",
G_CALLBACK(on_down_button_clicked), i);
g_signal_connect(i->remove_button, "clicked",
G_CALLBACK(on_remove_button_clicked), i);
g_signal_connect(i->up_button, "clicked",
G_CALLBACK(on_up_button_clicked), i);

g_signal_connect(G_OBJECT(i->dialog), "delete_event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);

Expand Down
5 changes: 2 additions & 3 deletions src/lassi-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1426,11 +1426,10 @@ static int server_init(LassiServer *ls) {
if (lassi_osd_init(&ls->osd_info) < 0)
goto finish;

if (lassi_clipboard_init(&ls->clipboard_info, ls) < 0)
if (lassi_tray_init(&ls->tray_info, ls) < 0)
goto finish;


if (lassi_tray_init(&ls->tray_info, ls) < 0)
if (lassi_clipboard_init(&ls->clipboard_info, ls) < 0)
goto finish;

if (lassi_prefs_init(&ls->prefs_info, ls) < 0)
Expand Down
6 changes: 0 additions & 6 deletions src/mango-lassi.ui
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<signal name="clicked" handler="on_add_button_clicked"/>
<child>
<object class="GtkHBox" id="hbox6">
<property name="visible">True</property>
Expand Down Expand Up @@ -97,7 +96,6 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<signal name="clicked" handler="on_up_button_clicked"/>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
Expand Down Expand Up @@ -143,7 +141,6 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<signal name="clicked" handler="on_down_button_clicked"/>
<child>
<object class="GtkHBox" id="hbox4">
<property name="visible">True</property>
Expand Down Expand Up @@ -188,7 +185,6 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<signal name="clicked" handler="on_remove_button_clicked"/>
<child>
<object class="GtkHBox" id="hbox5">
<property name="visible">True</property>
Expand Down Expand Up @@ -295,7 +291,6 @@ Please make sure to run Mango Lassi Input Sharing on all computers you want so s
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_close_button_clicked"/>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -310,7 +305,6 @@ Please make sure to run Mango Lassi Input Sharing on all computers you want so s
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_help_button_clicked"/>
</object>
<packing>
<property name="expand">False</property>
Expand Down

0 comments on commit a304e0d

Please sign in to comment.