void xneur_start_stop(GtkWidget *widget, struct _tray_icon *tray) { if (widget){}; if (xconfig->kill(xconfig) == TRUE) { create_tray_icon(tray, FALSE); return; } xneur_start(); create_tray_icon(tray, TRUE); }
int main(int argc, char *argv[]) { gtk_init(&argc, &argv); GError* error = NULL; eye_proxy = org_zlbruce_eyerest_basic_proxy_new_for_bus_sync( G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, "org.zlbruce.eyerest", "/", NULL, &error); if(eye_proxy == NULL) { g_print ("init dbus failed: %s\n", error->message); return -1; } g_signal_connect(G_OBJECT(eye_proxy), "status", G_CALLBACK(on_status), NULL); tray_icon = create_tray_icon(); menu = create_menu(); gtk_main(); g_object_unref (eye_proxy); return 0; }
int main(int argc, char **argv) { (void) signal(SIGALRM, updateData); findBattPath(); strncpy(capname, syspath, PATH_MAX); strcat(capname, "energy_full"); FILE* fp = fopen(capname, "r"); if (fp == NULL) { strncpy(capname, syspath, PATH_MAX); strcat(capname, "charge_full"); fp = fopen(capname, "r"); } fscanf(fp, "%d", &lastfullcap); fclose(fp); printf("lastfull: %d\n", lastfullcap); gtk_init(&argc, &argv); ico = create_tray_icon(); alarm(2); updateData(0); gtk_main(); return 0; }
bool windows_tray_notification::show(std::string title, std::string message) { adjust_length(title, message); const bool tray_icon_exist = nid != NULL; if (!tray_icon_exist) { const bool tray_icon_created = create_tray_icon(); if (!tray_icon_created) { const bool memory_allocated = nid != NULL; if (memory_allocated) { destroy_tray_icon(); } return false; } } // at this point tray icon was just created or already existed before, so it's safe to call `set_tray_message` const bool result = set_tray_message(title, message); // the `destroy_tray_icon` will be called by event only if `set_tray_message` succeeded // if it doesn't succeed, we have to call `destroy_tray_icon` manually if (!result) { destroy_tray_icon(); } return result; }
static void clock_check_xneur (EggClock *clock, int hours, int minutes, int seconds, gpointer data) { if (clock || hours || minutes || seconds) {}; struct _tray_icon *tray = data; int xneur_pid = xneur_config_get_pid(); if (xneur_pid == xneur_old_pid) return; xneur_old_pid = xneur_pid; if (xneur_pid == -1) create_tray_icon(tray, FALSE); else create_tray_icon(tray, TRUE); }
int main (int argc, char **argv) { gint ret; setlocale (LC_ALL, ""); bindtextdomain (CBATTICON_TEXT_DOMAIN, NLSDIR); bind_textdomain_codeset (CBATTICON_TEXT_DOMAIN, "UTF-8"); textdomain (CBATTICON_TEXT_DOMAIN); ret = get_options (argc, argv); if (ret <= 0) return ret; #ifdef WITH_NOTIFY if (configuration.hide_notification == FALSE) { if (notify_init ("cbatticon") == FALSE) { return -1; } } #endif if (get_power_supply (argc > 1 ? argv[1] : NULL, FALSE) == FALSE) { return -1; } create_tray_icon (); gtk_main(); return 0; }
int main(int argc, char **argv) { GtkStatusIcon *tray_icon; gtk_init(&argc, &argv); tray_icon = create_tray_icon(); GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "GtkStatusIcon Example"); gtk_widget_set_size_request (window, 200, -1); /* Set a handler for delete_event that immediately exits GTK. */ g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (delete_event), NULL); g_signal_connect(G_OBJECT(tray_icon), "activate", G_CALLBACK(winShowHide), window); gtk_widget_show_all (window); /* TESTING */ SetIconText(tray_icon,"1", "#000000"); gtk_main(); return 0; }
/*The Main Program*/ int main(int argc, char** argv) { /* defines the tray_icon, as well as init gtk*/ g_set_application_name(PACKAGE_NAME); parse_command_line_options(argc,argv); register_thread("Main Thread"); if (!queue_init()) print("queue_init FAILED",NULL,ERROR); print("Glade File",glade_file,DEBUG); g_thread_init(NULL); gtk_init(NULL,NULL); gtk_init(&argc, &argv); Hosts_lock = g_mutex_new(); Userpath_lock = g_mutex_new(); g_mutex_lock(Userpath_lock); Userpath = g_strdup(getenv("HOME")); g_mutex_unlock(Userpath_lock); settings_init(); rest_init(); if (!xml_init()) print("xml_init FAILED",NULL,ERROR); init_hostname(); /*sets the tray icon from the create_tray_icon*/ create_tray_icon(); playing_info_music pInfo = {"Artist","Album","Song",0,0,0}; /* declares the playing info struct, and print if, if _DEBUG is definded at the top of msdaemon.c*/ /*inits the dbus and get the first set of info*/ dbus_init(); pInfo = dbus_get_playing_info_music(); print_playing_info_music(pInfo); get_active_devices(NULL); update_song_info(); GError *error; if ( (network_thread = g_thread_create((GThreadFunc)rest_thread_handler, NULL, FALSE, &error)) == NULL){ print("Error Creating Network Thread",error->message,ERROR); g_error_free(error); } if ( (file_thread = g_thread_create((GThreadFunc)file_thread_handler, NULL, FALSE, &error)) == NULL){ print("Error Creating Network Thread",error->message,ERROR); g_error_free(error); } if ( (gui_thread = g_thread_create((GThreadFunc)gui_thread_handler, NULL, FALSE, &error)) == NULL){ print("Error Creating Network Thread",error->message,ERROR); g_error_free(error); } g_timeout_add (1000,(GSourceFunc) get_next_command,NULL); g_timeout_add (300000,(GSourceFunc) update_active_devices,NULL); init_status_window(FALSE,glade_file); start_tray(); g_free(Userpath); deauthenticate(); return 0; }
void native_loop(const char* title, unsigned char *imageData, unsigned int imageDataLen) { int argc = 0; char *argv[] = { "" }; menu_title = title; gtk_init(&argc, (char***)&argv); create_tray_icon(imageData, imageDataLen); gtk_main(); }
TrayControlWindow::TrayControlWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::TrayControlWindow), m_hub_section(NULL), m_vbox_section(NULL), m_launch_section(NULL), m_info_section(NULL), m_quit_section(NULL), m_act_generate_ssh(NULL), m_act_quit(NULL), m_act_settings(NULL), m_act_info(NULL), m_act_vbox(NULL), m_act_hub(NULL), m_act_launch(NULL), m_act_launch_SS(NULL), m_act_launch_Hub(NULL), m_act_about(NULL), m_sys_tray_icon(NULL), m_tray_menu(NULL) { ui->setupUi(this); m_w_Player = new CVBPlayer(this); create_tray_actions(); create_tray_icon(); m_sys_tray_icon->show(); refresh_timer_timeout(); //update data on start. hack m_refresh_timer.setInterval(CSettingsManager::Instance().refresh_time_sec()*1000); m_refresh_timer.start(); m_ss_updater_timer.setInterval(3*60*60*1000); //3 hours m_ss_updater_timer.start(); connect(&m_refresh_timer, SIGNAL(timeout()), this, SLOT(refresh_timer_timeout())); connect(CVBoxManagerSingleton::Instance(), SIGNAL(vm_add(const com::Bstr&)), this, SLOT(vm_added(const com::Bstr&))); connect(CVBoxManagerSingleton::Instance(), SIGNAL(vm_remove(const com::Bstr&)), this, SLOT(vm_removed(const com::Bstr&))); connect(CVBoxManagerSingleton::Instance(), SIGNAL(vm_state_changed(const com::Bstr&)), this, SLOT(vm_state_changed(const com::Bstr&))); connect(CNotifiactionObserver::Instance(), SIGNAL(notify(notification_level_t, const QString&)), this, SLOT(notification_received(notification_level_t, const QString&))); connect(&m_ss_updater_timer, SIGNAL(timeout()), this, SLOT(updater_timer_timeout())); connect(&CHubController::Instance(), SIGNAL(ssh_to_container_finished(int,void*)), this, SLOT(ssh_to_container_finished(int,void*))); }
/** * Program entry point. Initializes gtk+, calls the widget creating * functions and starts the main loop. Also connects 'popup-menu', * 'activate' and 'button-release-event' to the tray_icon. * * @param argc count of arguments * @param argv string array of arguments * @return 0 for success, otherwise error code */ int main (int argc, char *argv[]) { GError *error = NULL; GOptionContext *context; #ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); #endif DEBUG_PRINT("[Debugging Mode Build]\n"); setlocale(LC_ALL, ""); context = g_option_context_new (_("- A mixer for the system tray.")); g_option_context_add_main_entries (context, args, GETTEXT_PACKAGE); g_option_context_add_group (context, gtk_get_option_group (TRUE)); g_option_context_parse (context, &argc, &argv, &error); gtk_init (&argc, &argv); g_option_context_free(context); if (version) { printf(_("%s version: %s\n"),PACKAGE,VERSION); exit(0); } popup_window = NULL; status_icons[0] = status_icons[1] = status_icons[2] = status_icons[3] = NULL; add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps"); add_pixmap_directory ("./pixmaps"); ensure_prefs_dir(); load_prefs(); cards = NULL; // so we don't try and free on first run alsa_init(); init_libnotify(); create_popups(); add_filter(); tray_icon = create_tray_icon(); apply_prefs(0); g_signal_connect(G_OBJECT(tray_icon), "popup-menu",G_CALLBACK(popup_callback), popup_menu); g_signal_connect(G_OBJECT(tray_icon), "activate", G_CALLBACK(tray_icon_on_click), NULL); g_signal_connect(G_OBJECT(tray_icon), "button-release-event", G_CALLBACK(tray_icon_button), NULL); gtk_main (); uninit_libnotify(); alsa_close(); return 0; }
int main (int argc, char **argv) { GtkStatusIcon *tray_icon; gtk_init (&argc, &argv); tray_icon = create_tray_icon(); window = create_mooWindow (); gtk_widget_show (window); gtk_main (); return 0; }
int main( int argc, char* argv[] ) { gtk_init( &argc, &argv ); set_browser("xdg-open"); create_dirs(); create_tray_icon(); create_primary_menu(); gtk_main(); // Remove temporary files on exit clean_up(); return 0; }
int main (int argc, char *argv[]){ // pokazivaci na widgete GtkBuilder *builder; GtkStatusIcon *tray_icon; //inicijalizacija gtk_init (&argc, &argv); system("echo level auto > /proc/acpi/ibm/fan"); builder = gtk_builder_new (); gtk_builder_add_from_file (builder, BUILDER_XML_FILE, NULL); // tray ikona tray_icon = create_tray_icon(); window = GTK_WIDGET (gtk_builder_get_object (builder, "window")); run = GTK_BUTTON (gtk_builder_get_object (builder, "run")); exitButton = GTK_BUTTON (gtk_builder_get_object (builder, "exit")); hide = GTK_BUTTON (gtk_builder_get_object (builder, "hide")); sleepField = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "sleep")); criticalField = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "critical")); safeField = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "safe")); txtLog = GTK_LABEL (gtk_builder_get_object (builder, "log")); statusbar = GTK_STATUSBAR (gtk_builder_get_object (builder, "statusbar")); level = GTK_LABEL (gtk_builder_get_object (builder, "level")); g_signal_connect(G_OBJECT(run), "clicked", G_CALLBACK(run_clicked), NULL); g_signal_connect(G_OBJECT(exitButton), "clicked", G_CALLBACK(on_window_destroy), NULL); g_signal_connect(G_OBJECT(hide), "clicked", G_CALLBACK(tray_icon_on_click), NULL); gtk_builder_connect_signals (builder, NULL); g_object_unref (G_OBJECT (builder)); gtk_widget_show (window); gtk_main (); return 0; }
int main(int argc, char *argv[]) { #ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); #endif gtk_set_locale(); gtk_init(&argc, &argv); add_pixmap_directory(PACKAGE_PIXMAPS_DIR); xneur_restart(); create_tray_icon(NULL, TRUE); gtk_main(); return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { #ifdef ENABLE_NLS setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); bind_textdomain_codeset(PACKAGE, "UTF-8"); textdomain(PACKAGE); #endif gtk_set_locale(); gtk_init(&argc, &argv); static struct option longopts[] = { { "help", no_argument, NULL, 'h' }, { "configure", no_argument, NULL, 'c' }, { "delay", required_argument, NULL, 'D' }, { "keyboard-properties", required_argument, NULL, 1000 }, { "rendering-engine", required_argument, NULL, 'E' }, { "show", required_argument, NULL, 'S' }, { "disable-settings-storage", no_argument, NULL, 1001 }, { "store", no_argument, NULL, 'e' }, { NULL, 0, NULL, 0 } }; gboolean store = FALSE; int opt; while ((opt = getopt_long(argc, argv, "hcS:D:E:e", longopts, NULL)) != -1) { switch (opt) { case 'D': { arg_delay = atoi(optarg); if (store) gxneur_config_write_int("delay", arg_delay, TRUE); break; } case 'S': { arg_show_in_the_tray = optarg; if (store) gxneur_config_write_str("show_in_the_tray", arg_show_in_the_tray, TRUE); break; } case 1000: { arg_keyboard_properties = optarg; if (store) gxneur_config_write_str("keyboard_properties", arg_keyboard_properties, TRUE); break; } case 1001: { gxneur_config_set_enabled(FALSE); break; } case 'E': { arg_rendering_engine = optarg; if (store) gxneur_config_write_str("rendering_engine", arg_rendering_engine, TRUE); break; } case 'c': { printf(_("\nThis option under construction. Sorry.\n")); return EXIT_SUCCESS; break; } case 'e': { store = TRUE; break; } case '?': case 'h': { printf(_("\nGTK2 frontend for XNeur (version %s) \n"), VERSION); printf(_("usage: gxneur [options]\n")); printf(_(" where options are:\n")); printf("\n"); printf(_(" -D, --delay=<seconds> Seconds to wait before starting xneur\n")); printf(_(" -E, --rendering-engine=<engine> Rendering engine to use (Built-in, StatusIcon, AppIndicator. Default is %s.)\n"), DEFAULT_RENDERING_ENGINE); printf(_(" -S, --show=<mode> Icon display mode (Icon, Flag, Text. Default is %s.)\n"), DEFAULT_SHOW_IN_THE_TRAY); printf(_(" --keyboard-properties=<command> Command to run on \"Keyboard Properties\" menu item. Default is %s.\n"), KB_PROP_COMMAND); printf(_(" -e --store Save settings from the command line to the storage and exit\n")); printf(_(" --disable-settings-storage Disable reading and saving gxneur settings to the persistent storage\n")); printf(_(" -c, --configure Configure xneur and gxneur\n")); printf(_(" -h, --help Display this help and exit\n")); exit(EXIT_SUCCESS); break; } } } if (store) exit(EXIT_SUCCESS); int value = -1; gxneur_config_read_int("delay", &value); if (arg_delay >= 0) value = arg_delay; if (value <= 0) value = DEFAULT_DELAY; sleep (value); signal(SIGCHLD, trap_child); xneur_start(); create_tray_icon(); gtk_main(); return EXIT_SUCCESS; }