static void remmina_icon_popdown_menu(GtkWidget *widget, gpointer data) { if (gtk_get_current_event_time() - remmina_icon.popup_time <= 500) { remmina_exec_command(REMMINA_COMMAND_MAIN, NULL); } }
static void remmina_icon_on_edit_item(RemminaAppletMenu *menu, RemminaAppletMenuItem *menuitem, gpointer data) { gchar *s; switch (menuitem->item_type) { case REMMINA_APPLET_MENU_ITEM_NEW: remmina_exec_command(REMMINA_COMMAND_NEW, NULL); break; case REMMINA_APPLET_MENU_ITEM_FILE: remmina_exec_command(REMMINA_COMMAND_EDIT, menuitem->filename); break; case REMMINA_APPLET_MENU_ITEM_DISCOVERED: s = g_strdup_printf("%s,%s", menuitem->protocol, menuitem->name); remmina_exec_command(REMMINA_COMMAND_NEW, s); g_free(s); break; } }
static void remmina_icon_about(void) { remmina_exec_command(REMMINA_COMMAND_ABOUT, NULL); }
static void remmina_icon_preferences(void) { remmina_exec_command(REMMINA_COMMAND_PREF, "2"); }
static void remmina_icon_main(void) { remmina_exec_command(REMMINA_COMMAND_MAIN, NULL); }
static gint remmina_on_command_line(GApplication *app, GApplicationCommandLine *cmdline) { gint status = 0; gint argc; gchar **argv; GError *error = NULL; GOptionContext *context; gboolean parsed; gchar *s; gboolean executed = FALSE; remmina_option_about = FALSE; remmina_option_connect = NULL; remmina_option_edit = NULL; remmina_option_help = FALSE; remmina_option_new = FALSE; remmina_option_pref = NULL; remmina_option_plugin = NULL; remmina_option_server = NULL; remmina_option_protocol = NULL; remmina_option_icon = FALSE; argv = g_application_command_line_get_arguments(cmdline, &argc); context = g_option_context_new("- The GTK+ Remote Desktop Client"); g_option_context_add_main_entries(context, remmina_options, GETTEXT_PACKAGE); g_option_context_set_help_enabled(context, FALSE); parsed = g_option_context_parse(context, &argc, &argv, &error); g_strfreev(argv); if (!parsed) { g_print("option parsing failed: %s\n", error->message); status = 1; } if (remmina_option_quit) { gtk_main_quit(); status = 1; } if (remmina_option_about) { remmina_exec_command(REMMINA_COMMAND_ABOUT, NULL); executed = TRUE; } if (remmina_option_connect) { remmina_exec_command(REMMINA_COMMAND_CONNECT, remmina_option_connect); executed = TRUE; } if (remmina_option_edit) { remmina_exec_command(REMMINA_COMMAND_EDIT, remmina_option_edit); executed = TRUE; } if (remmina_option_help) { s = g_option_context_get_help(context, TRUE, NULL); g_print("%s", s); g_free(s); status = 1; } if (remmina_option_new) { if (remmina_option_server) { s = g_strdup_printf("%s,%s", remmina_option_protocol, remmina_option_server); } else { s = g_strdup(remmina_option_protocol); } remmina_exec_command(REMMINA_COMMAND_NEW, s); g_free(s); executed = TRUE; } if (remmina_option_pref) { remmina_exec_command(REMMINA_COMMAND_PREF, remmina_option_pref); executed = TRUE; } if (remmina_option_plugin) { remmina_exec_command(REMMINA_COMMAND_PLUGIN, remmina_option_plugin); executed = TRUE; } if (remmina_option_icon) { remmina_exec_command(REMMINA_COMMAND_NONE, remmina_option_icon); executed = TRUE; } if (!executed) { remmina_exec_command(REMMINA_COMMAND_MAIN, NULL); } g_option_context_free(context); return status; }