~ghugesss/xpad/debug_support

« back to all changes in this revision

Viewing changes to src/xpad-tray.c

  • Committer: Arthur Borsboom
  • Date: 2014-06-19 13:15:30 UTC
  • mfrom: (665.1.59 xpad-4.3)
  • Revision ID: arthurborsboom@gmail.com-20140619131530-ecsvweog8592zqie
Fix: prevented color updating conflict between preferences and pad colors
Fix: Technical - reduced code by removing double code
Fix: Technical - ensured that all the menus of each pad are updated when changing options in the View menu
Fix: renamed Xpad_periodic functions to lowercase in line with other function namings
Fix: repaired showing all the notes in the menu: pad->menu->notes
Fix: Technical - removed unnecessary initialization and unnecessary function
Fix: Resolved a disposing error of the clipboard contents after erasing a pad
Fix: Pad properties - switched foreground and background order in GUI.
Fix: Technical - got rid of the global variable: xpad_global_settings
New: added shortcuts keys for New pad (CTRL-N) and Delete (SHIFT-DEL)
Fix: Technical - changed comment style
Fix: replaced get user home dir with specific glib function
Fix: Default values are set correctly on first startup (no configuration file) by reintroducing a double default value administration.
Fix: Improved performance by reducing the amount of GTK_ casts, as suggested in the GTK best practices
Fix: Applied GTK best practices for inclusion of 1st config.h and 2nd its header file in each c-file

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
*/
22
22
 
23
23
#include "../config.h"
 
24
#include "xpad-tray.h"
24
25
#include <gtk/gtk.h>
25
26
#include <glib/gi18n.h>
26
27
#include "fio.h"
28
29
#include "xpad-pad.h"
29
30
#include "xpad-preferences.h"
30
31
#include "xpad-settings.h"
31
 
#include "xpad-tray.h"
32
32
 
33
33
enum
34
34
{
45
45
/* tray icon left click handler */
46
46
static void xpad_tray_activate_cb (GtkStatusIcon *icon, XpadSettings *settings);
47
47
/* tray icon right click handler */
48
 
static void xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time);
 
48
static void xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time, XpadSettings *settings);
49
49
/* "toggle show all" menu item handler */
50
50
static void xpad_tray_show_hide_all ();
51
51
/* "show pads" menu item handler */
87
87
 
88
88
        if (docklet) {
89
89
                g_signal_connect (docklet, "activate", G_CALLBACK (xpad_tray_activate_cb), settings);
90
 
                g_signal_connect (docklet, "popup-menu", G_CALLBACK (xpad_tray_popup_menu_cb), NULL);
 
90
                g_signal_connect (docklet, "popup-menu", G_CALLBACK (xpad_tray_popup_menu_cb), settings);
91
91
        }
92
92
}
93
93
 
103
103
}
104
104
 
105
105
void xpad_tray_dispose (XpadSettings *settings) {
106
 
        if (xpad_global_settings)
 
106
        if (settings)
107
107
                g_signal_handlers_disconnect_by_func(settings, xpad_tray_toggle, NULL);
108
108
        xpad_tray_close (settings);
109
109
}
161
161
static void
162
162
menu_spawn (XpadPadGroup *group)
163
163
{
164
 
        GtkWidget *pad = xpad_pad_new (group);
 
164
        GSList *pads = xpad_pad_group_get_pads (group);
 
165
        XpadSettings *settings;
 
166
        g_object_get (g_slist_nth_data (pads, 0), "settings", &settings, NULL);
 
167
        GtkWidget *pad = xpad_pad_new (group, settings);
165
168
        gtk_widget_show (pad);
166
169
}
167
170
 
168
171
static void
169
 
xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time)
 
172
xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time, XpadSettings *settings)
170
173
{
171
174
        GtkWidget *item;
172
175
        GSList *pads;
213
216
        gtk_widget_show (item);
214
217
        
215
218
        item = gtk_menu_item_new_with_mnemonic (_("_Preferences"));     
216
 
        g_signal_connect (item, "activate", G_CALLBACK (xpad_preferences_open), NULL);
 
219
        g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_preferences_open), settings);
217
220
        gtk_container_add (GTK_CONTAINER (menu), item);
218
221
        gtk_widget_show (item);
219
222