Browse Source

Merge branch 'nick/wip-4.10'

upstream/xfce4-panel-4.10.1
Nick Schermer 12 years ago
parent
commit
7d714ceef5
  1. 4
      libxfce4panel/xfce-panel-macros-46.h
  2. 9
      libxfce4panel/xfce-panel-plugin-provider.c
  3. 6
      libxfce4panel/xfce-panel-plugin-provider.h
  4. 12
      libxfce4panel/xfce-panel-plugin.c
  5. 21
      panel/panel-application.c
  6. 80
      panel/panel-item-dialog.c
  7. 14
      panel/panel-plugin-external.c
  8. 4
      wrapper/main.c

4
libxfce4panel/xfce-panel-macros-46.h

@ -363,6 +363,10 @@ G_BEGIN_DECLS
gtk_widget_queue_draw (plug); \
break; \
\
case PROVIDER_PROP_TYPE_ACTION_ASK_REMOVE: \
xfce_panel_plugin_provider_ask_remove (provider); \
break; \
\
default: \
g_warning ("Received unknow client event %u", type); \
break; \

9
libxfce4panel/xfce-panel-plugin-provider.c

@ -246,5 +246,14 @@ xfce_panel_plugin_provider_set_locked (XfcePanelPluginProvider *provider,
void
xfce_panel_plugin_provider_ask_remove (XfcePanelPluginProvider *provider)
{
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
(*XFCE_PANEL_PLUGIN_PROVIDER_GET_INTERFACE (provider)->ask_remove) (provider);
}
#define __XFCE_PANEL_PLUGIN_PROVIDER_C__
#include <libxfce4panel/libxfce4panel-aliasdef.c>

6
libxfce4panel/xfce-panel-plugin-provider.h

@ -68,6 +68,7 @@ struct _XfcePanelPluginProviderInterface
guint *handle);
void (*set_locked) (XfcePanelPluginProvider *provider,
gboolean locked);
void (*ask_remove) (XfcePanelPluginProvider *provider);
};
/* signals send from the plugin to the panel (possibly through the wrapper) */
@ -109,7 +110,8 @@ typedef enum /*< skip >*/
PROVIDER_PROP_TYPE_ACTION_QUIT_FOR_RESTART, /* none */
PROVIDER_PROP_TYPE_ACTION_BACKGROUND_UNSET, /* none */
PROVIDER_PROP_TYPE_ACTION_SHOW_CONFIGURE, /* none */
PROVIDER_PROP_TYPE_ACTION_SHOW_ABOUT /* none */
PROVIDER_PROP_TYPE_ACTION_SHOW_ABOUT, /* none */
PROVIDER_PROP_TYPE_ACTION_ASK_REMOVE /* none */
}
XfcePanelPluginProviderPropType;
@ -179,6 +181,8 @@ gboolean xfce_panel_plugin_provider_remote_event (XfcePanelP
void xfce_panel_plugin_provider_set_locked (XfcePanelPluginProvider *provider,
gboolean locked);
void xfce_panel_plugin_provider_ask_remove (XfcePanelPluginProvider *provider);
G_END_DECLS
#endif /* !__XFCE_PANEL_PLUGIN_PROVIDER_H__ */

12
libxfce4panel/xfce-panel-plugin.c

@ -106,6 +106,7 @@ static gboolean xfce_panel_plugin_remote_event (XfcePanelPluginPr
guint *handle);
static void xfce_panel_plugin_set_locked (XfcePanelPluginProvider *provider,
gboolean locked);
static void xfce_panel_plugin_ask_remove (XfcePanelPluginProvider *provider);
static void xfce_panel_plugin_take_window_notify (gpointer data,
GObject *where_the_object_was);
static void xfce_panel_plugin_menu_item_destroy (GtkWidget *item,
@ -619,6 +620,7 @@ xfce_panel_plugin_provider_init (XfcePanelPluginProviderInterface *iface)
iface->removed = xfce_panel_plugin_removed;
iface->remote_event = xfce_panel_plugin_remote_event;
iface->set_locked = xfce_panel_plugin_set_locked;
iface->ask_remove = xfce_panel_plugin_ask_remove;
}
@ -1391,6 +1393,16 @@ xfce_panel_plugin_set_locked (XfcePanelPluginProvider *provider,
static void
xfce_panel_plugin_ask_remove (XfcePanelPluginProvider *provider)
{
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (provider));
xfce_panel_plugin_menu_remove (XFCE_PANEL_PLUGIN (provider));
}
static void
xfce_panel_plugin_take_window_notify (gpointer data,
GObject *where_the_object_was)

21
panel/panel-application.c

@ -363,6 +363,23 @@ panel_application_load (PanelApplication *application)
static void
panel_application_plugin_move_drag_data_get (GtkWidget *item,
GdkDragContext *drag_context,
GtkSelectionData *selection_data,
guint info,
guint drag_time,
PanelApplication *application)
{
/* set some data, we never use this, but GTK_DEST_DEFAULT_ALL
* used in the item dialog requires this */
gtk_selection_data_set (selection_data,
selection_data->target, 8,
(const guchar *) "0", 1);
}
static void
panel_application_plugin_move_drag_end (GtkWidget *item,
GdkDragContext *context,
@ -374,6 +391,8 @@ panel_application_plugin_move_drag_end (GtkWidget *item,
/* disconnect this signal */
g_signal_handlers_disconnect_by_func (G_OBJECT (item),
G_CALLBACK (panel_application_plugin_move_drag_end), application);
g_signal_handlers_disconnect_by_func (G_OBJECT (item),
G_CALLBACK (panel_application_plugin_move_drag_data_get), application);
/* make the window sensitive again */
panel_application_windows_sensitive (application, TRUE);
@ -415,6 +434,8 @@ panel_application_plugin_move (GtkWidget *item,
/* signal to make the window sensitive again on a drag end */
g_signal_connect (G_OBJECT (item), "drag-end",
G_CALLBACK (panel_application_plugin_move_drag_end), application);
g_signal_connect (G_OBJECT (item), "drag-data-get",
G_CALLBACK (panel_application_plugin_move_drag_data_get), application);
}

80
panel/panel-item-dialog.c

@ -68,22 +68,30 @@ static void panel_item_dialog_drag_begin (GtkWidget
static void panel_item_dialog_drag_data_get (GtkWidget *treeview,
GdkDragContext *context,
GtkSelectionData *selection_data,
guint info,
guint drag_time,
PanelItemDialog *dialog);
static void panel_item_dialog_populate_store (PanelItemDialog *dialog);
static gint panel_item_dialog_compare_func (GtkTreeModel *model,
GtkTreeIter *a,
GtkTreeIter *b,
gpointer user_data);
static gboolean panel_item_dialog_visible_func (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data);
static void panel_item_dialog_text_renderer (GtkTreeViewColumn *column,
GtkCellRenderer *renderer,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data);
guint info,
guint drag_time,
PanelItemDialog *dialog);
static void panel_item_dialog_drag_data_received (GtkWidget *treeview,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection_data,
guint info,
guint drag_time,
PanelItemDialog *dialog);
static void panel_item_dialog_populate_store (PanelItemDialog *dialog);
static gint panel_item_dialog_compare_func (GtkTreeModel *model,
GtkTreeIter *a,
GtkTreeIter *b,
gpointer user_data);
static gboolean panel_item_dialog_visible_func (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data);
static void panel_item_dialog_text_renderer (GtkTreeViewColumn *column,
GtkCellRenderer *renderer,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data);
@ -116,7 +124,12 @@ enum
static const GtkTargetEntry drag_targets[] =
{
{ "xfce-panel/plugin-name", 0, 0 },
{ "xfce-panel/plugin-name", 0, 0 }
};
static const GtkTargetEntry drop_targets[] =
{
{ "xfce-panel/plugin-widget", GTK_TARGET_SAME_APP, 0 }
};
@ -248,6 +261,11 @@ panel_item_dialog_init (PanelItemDialog *dialog)
g_signal_connect (G_OBJECT (treeview), "drag-begin", G_CALLBACK (panel_item_dialog_drag_begin), dialog);
g_signal_connect (G_OBJECT (treeview), "drag-data-get", G_CALLBACK (panel_item_dialog_drag_data_get), dialog);
/* remove plugin when dropping it back in the treeview */
gtk_drag_dest_set (GTK_WIDGET (treeview), GTK_DEST_DEFAULT_ALL,
drop_targets, G_N_ELEMENTS (drop_targets), GDK_ACTION_MOVE);
g_signal_connect (G_OBJECT (treeview), "drag-data-received", G_CALLBACK (panel_item_dialog_drag_data_received), dialog);
/* icon renderer */
renderer = gtk_cell_renderer_pixbuf_new ();
column = gtk_tree_view_column_new_with_attributes ("", renderer, "icon-name", COLUMN_ICON_NAME, "sensitive", COLUMN_SENSITIVE, NULL);
@ -530,6 +548,34 @@ panel_item_dialog_drag_data_get (GtkWidget *treeview,
static void
panel_item_dialog_drag_data_received (GtkWidget *treeview,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection_data,
guint info,
guint drag_time,
PanelItemDialog *dialog)
{
GtkWidget *widget;
panel_return_if_fail (GTK_IS_TREE_VIEW (treeview));
panel_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
panel_return_if_fail (PANEL_IS_ITEM_DIALOG (dialog));
/* ask the plugin to cleanup when we destroy a panel window */
widget = gtk_drag_get_source_widget (context);
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget));
xfce_panel_plugin_provider_ask_remove (XFCE_PANEL_PLUGIN_PROVIDER (widget));
gtk_drag_finish (context, TRUE, FALSE, drag_time);
g_signal_stop_emission_by_name (G_OBJECT (treeview), "drag-data-received");
}
static void
panel_item_dialog_populate_store (PanelItemDialog *dialog)
{

14
panel/panel-plugin-external.c

@ -101,6 +101,7 @@ static gboolean panel_plugin_external_remote_event (XfcePanelPlug
guint *handler_id);
static void panel_plugin_external_set_locked (XfcePanelPluginProvider *provider,
gboolean locked);
static void panel_plugin_external_ask_remove (XfcePanelPluginProvider *provider);
static void panel_plugin_external_set_sensitive (PanelPluginExternal *external);
@ -230,6 +231,7 @@ panel_plugin_external_provider_init (XfcePanelPluginProviderInterface *iface)
iface->removed = panel_plugin_external_removed;
iface->remote_event = panel_plugin_external_remote_event;
iface->set_locked = panel_plugin_external_set_locked;
iface->ask_remove = panel_plugin_external_ask_remove;
}
@ -999,6 +1001,18 @@ panel_plugin_external_set_locked (XfcePanelPluginProvider *provider,
static void
panel_plugin_external_ask_remove (XfcePanelPluginProvider *provider)
{
panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (provider));
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (provider));
panel_plugin_external_queue_add_action (PANEL_PLUGIN_EXTERNAL (provider),
PROVIDER_PROP_TYPE_ACTION_ASK_REMOVE);
}
static void
panel_plugin_external_set_sensitive (PanelPluginExternal *external)
{

4
wrapper/main.c

@ -143,6 +143,10 @@ wrapper_gproxy_set (DBusGProxy *dbus_gproxy,
xfce_panel_plugin_provider_show_about (provider);
break;
case PROVIDER_PROP_TYPE_ACTION_ASK_REMOVE:
xfce_panel_plugin_provider_ask_remove (provider);
break;
default:
panel_assert_not_reached ();
break;

Loading…
Cancel
Save