From: Giuseppe P. <gi...@gm...> - 2012-08-16 15:17:51
|
Hi, In the preferences dialog of the application launch bar plugin there are two lists and after selecting an item from the left you have to click on the button "remove" to remove it, after you select an item from the right you have to click on the button "add" to add it. I made this quicher enabling the double click as intuitive in my opinion: 1) if you double click on an item on the left you remove it 2) if you double click on an item on the right you add it (appears on the left) f you are interested in taking the code, the patch is minimal (in the link the commit with the diff, click on the plus to see the changes): http://code.google.com/p/giuspen-lxpanel-0-5-10/source/detail?r=f5d4fa881576012eec8387367569255c92d9b075&name=xkb# src/plugins/launchbar.c @@ -93,6 +93,7 @@ GSList * buttons; /* Launchbar buttons */ GtkWidget * config_dlg; /* Configuration dialog */ LaunchButton * bootstrap_button; /* Bootstrapping button for empty launchbar */ + GtkWidget *p_button_add, *p_button_remove; } LaunchbarPlugin; void panel_config_save(Panel * panel); /* defined in configurator.c */ @@ -133,6 +134,32 @@ g_free(btn); } +static gboolean on_defined_view_button_press_event(GtkWidget *p_widget, GdkEventButton *p_event, gpointer p_data) +{ + if(p_event->button == 1) + { + if(p_event->type == GDK_2BUTTON_PRESS) + { + LaunchbarPlugin *lb = (LaunchbarPlugin *)p_data; + gtk_button_clicked(GTK_BUTTON(lb->p_button_remove)); + } + } + return FALSE; +} + +static gboolean on_menu_view_button_press_event(GtkWidget *p_widget, GdkEventButton *p_event, gpointer p_data) +{ + if(p_event->button == 1) + { + if(p_event->type == GDK_2BUTTON_PRESS) + { + LaunchbarPlugin *lb = (LaunchbarPlugin *)p_data; + gtk_button_clicked(GTK_BUTTON(lb->p_button_add)); + } + } + return FALSE; +} + /* Handler for "button-press-event" event from launchbar button. */ static gboolean launchbutton_press_event(GtkWidget * widget, GdkEventButton * event, LaunchButton * b) { @@ -831,11 +858,11 @@ /* Connect signals. */ g_signal_connect(dlg, "response", G_CALLBACK(launchbar_configure_response), p); - btn = (GtkWidget*)gtk_builder_get_object(builder, "add"); - g_signal_connect(btn, "clicked", G_CALLBACK(launchbar_configure_add_button), p); + lb->p_button_add = (GtkWidget*)gtk_builder_get_object(builder, "add"); + g_signal_connect(lb->p_button_add, "clicked", G_CALLBACK(launchbar_configure_add_button), p); - btn = (GtkWidget*)gtk_builder_get_object(builder, "remove"); - g_signal_connect(btn, "clicked", G_CALLBACK(launchbar_configure_remove_button), p); + lb->p_button_remove = (GtkWidget*)gtk_builder_get_object(builder, "remove"); + g_signal_connect(lb->p_button_remove, "clicked", G_CALLBACK(launchbar_configure_remove_button), p); btn = (GtkWidget*)gtk_builder_get_object(builder, "up"); g_signal_connect(btn, "clicked", G_CALLBACK(launchbar_configure_move_up_button), p); @@ -843,6 +870,9 @@ btn = (GtkWidget*)gtk_builder_get_object(builder, "down"); g_signal_connect(btn, "clicked", G_CALLBACK(launchbar_configure_move_down_button), p); + g_signal_connect(defined_view, "button-press-event", G_CALLBACK(on_defined_view_button_press_event), lb); + g_signal_connect(menu_view, "button-press-event", G_CALLBACK(on_menu_view_button_press_event), lb); + gtk_window_present(GTK_WINDOW(dlg)); lb->config_dlg = dlg; Cheers, Giuseppe. |