/** * Handles button-release-event' signal on the tray_icon, currently * only used for middle-click. * * @param status_icon the object which received the signal * @param event the GdkEventButton which triggered this signal * @param user_data user data set when the signal handler was * connected */ void tray_icon_button(GtkStatusIcon *status_icon, GdkEventButton *event, gpointer user_data) { if (event->button == 2) { gint act = 0; if (g_key_file_has_key(keyFile,"PNMixer","MiddleClickAction",NULL)) act = g_key_file_get_integer(keyFile,"PNMixer","MiddleClickAction",NULL); switch (act) { case 0: // mute/unmute setmute(mouse_noti); get_mute_state(TRUE); break; case 1: do_prefs(); break; case 2: { on_mixer(); break; } case 3: if (g_key_file_has_key(keyFile,"PNMixer","CustomCommand",NULL)) { gchar* cmd = g_key_file_get_string(keyFile,"PNMixer","CustomCommand",NULL); if (cmd) { run_command(cmd); g_free(cmd); } else // This shouldn't ever happen, so let's just write to console g_warning("KeyFile has CustomCommand key, but get_string returned NULL"); } else report_error(_("You have not specified a custom command to run, please specify one in preferences.")); break; default: {} // nothing } } }
/** * Handles button-release-event' signal on the tray_icon, currently * only used for middle-click. * * @param status_icon the object which received the signal * @param event the GdkEventButton which triggered this signal * @param user_data user data set when the signal handler was * connected */ void tray_icon_button(G_GNUC_UNUSED GtkStatusIcon *status_icon, GdkEventButton *event, G_GNUC_UNUSED gpointer user_data) { gint action; if (event->button != 2) return; action = prefs_get_integer("MiddleClickAction", 0); switch (action) { case 0: // mute/unmute setmute(mouse_noti); on_volume_has_changed(); break; case 1: do_prefs(); break; case 2: on_mixer(); break; case 3: { gchar *cmd; cmd = prefs_get_string("CustomCommand", NULL); if (cmd) { run_command(cmd); g_free(cmd); } else report_error(_("You have not specified a custom command to run, " "please specify one in preferences.")); break; } default: { } // nothing } }