~ubuntu-branches/debian/sid/xfce4-clipman-plugin/sid

« back to all changes in this revision

Viewing changes to panel-plugin/main-panel-plugin.c

  • Committer: Package Import Robot
  • Author(s): Yves-Alexis Perez
  • Date: 2012-04-09 21:26:50 UTC
  • mfrom: (1.3.7)
  • Revision ID: package-import@ubuntu.com-20120409212650-u618echcdsndz3ak
Tags: 2:1.2.3-1
* New upstream release.
* debian/rules:
  - build with --parallel.
  - configure with --disable-static and stop removing .a files.
* debian/control:
  - update standards version to 3.9.3.
  - update debhelper build-dep to 9. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright (c) 2008-2011 Mike Massonnet <mmassonnet@xfce.org>
 
2
 *  Copyright (c) 2008-2012 Mike Massonnet <mmassonnet@xfce.org>
3
3
 *
4
4
 *  This program is free software; you can redistribute it and/or modify
5
5
 *  it under the terms of the GNU General Public License as published by
39
39
static void             panel_plugin_register           (XfcePanelPlugin *panel_plugin);
40
40
XFCE_PANEL_PLUGIN_REGISTER (panel_plugin_register);
41
41
 
 
42
static gboolean         plugin_set_size                 (MyPlugin *plugin,
 
43
                                                         gint size);
42
44
static gboolean         cb_button_pressed               (GtkButton *button,
43
45
                                                         GdkEventButton *event,
44
46
                                                         MyPlugin *plugin);
70
72
  gtk_widget_set_tooltip_text (GTK_WIDGET (panel_plugin), _("Clipman"));
71
73
 
72
74
  /* Panel Button */
73
 
  plugin->button = xfce_create_panel_toggle_button ();
 
75
  plugin->button = xfce_panel_create_toggle_button ();
74
76
  if (gtk_icon_theme_has_icon (icon_theme, "clipman"))
75
77
    {
76
78
      plugin->image = xfce_panel_image_new_from_source ("clipman");
81
83
    }
82
84
  gtk_container_add (GTK_CONTAINER (plugin->button), plugin->image);
83
85
  gtk_container_add (GTK_CONTAINER (panel_plugin), plugin->button);
 
86
 
 
87
#if LIBXFCE4PANEL_CHECK_VERSION (4,9,0)
 
88
  xfce_panel_plugin_set_small (panel_plugin, TRUE);
 
89
#endif
 
90
 
84
91
  xfce_panel_plugin_add_action_widget (panel_plugin, plugin->button);
85
92
  g_signal_connect (plugin->button, "button-press-event",
86
93
                    G_CALLBACK (cb_button_pressed), plugin);
96
103
                            G_CALLBACK (plugin_save), plugin);
97
104
  g_signal_connect_swapped (panel_plugin, "free-data",
98
105
                            G_CALLBACK (plugin_free), plugin);
 
106
  g_signal_connect_swapped (panel_plugin, "size-changed",
 
107
                            G_CALLBACK (plugin_set_size), plugin);
99
108
  g_signal_connect (plugin->menu, "deactivate",
100
109
                    G_CALLBACK (cb_menu_deactivate), plugin);
101
110
 
103
112
}
104
113
 
105
114
static gboolean
 
115
plugin_set_size (MyPlugin *plugin,
 
116
                 gint size)
 
117
{
 
118
#if LIBXFCE4PANEL_CHECK_VERSION (4,9,0)
 
119
  size /= xfce_panel_plugin_get_nrows (plugin->panel_plugin);
 
120
#endif
 
121
  gtk_widget_set_size_request(GTK_WIDGET(plugin->button), size, size);
 
122
 
 
123
  return TRUE;
 
124
}
 
125
 
 
126
static gboolean
106
127
cb_button_pressed (GtkButton *button,
107
128
                   GdkEventButton *event,
108
129
                   MyPlugin *plugin)
130
151
                         gboolean *push_in,
131
152
                         MyPlugin *plugin)
132
153
{
133
 
  GtkWidget *button;
134
154
  gint button_width, button_height;
135
155
  GtkRequisition requisition;
136
156
  GtkOrientation orientation;
137
157
 
138
 
  button = plugin->button;
139
158
  orientation = xfce_panel_plugin_get_orientation (plugin->panel_plugin);
140
 
  gtk_widget_get_size_request (button, &button_width, &button_height);
 
159
  gtk_widget_get_size_request (plugin->button, &button_width, &button_height);
141
160
  gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
142
161
  gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (plugin->panel_plugin)), x, y);
143
162