void on_switch_icon_active_notify(GtkSwitch *widget, gpointer data) { g_settings_set_boolean(settings, "dark-icon", gtk_switch_get_active(widget)); update_tray(); }
static void edit_name_onenter(EDIT *edit) { char_t *data = edit->data; STRING_IDX length = edit->length; memcpy(self.name, data, length); self.name_length = length; update_tray(); postmessage_toxcore(TOX_SELF_SET_NAME, length, 0, self.name);//! }
gboolean check_update_tray(gpointer indicator) { /* save previous time values & generate new time */ gint day = today.tm_mday, mon = today.tm_mon, year = today.tm_year; time_gen(); /* update tray if day changes */ if(today.tm_mday != day || today.tm_mon != mon || today.tm_year != year) update_tray(); return G_SOURCE_CONTINUE; }
static void edit_status_onenter(EDIT *edit) { char_t *data = edit->data; STRING_IDX length = edit->length; if(length) { void *p = realloc(self.statusmsg, length); if(!p) { return; } self.statusmsg = p; memcpy(self.statusmsg, data, length); self.statusmsg_length = length; } else { self.statusmsg_length = length; } update_tray(); postmessage_toxcore(TOX_SELF_SET_STATUS, length, 0, self.statusmsg);//! }
void startup(GApplication *app, gpointer user_data) { GtkMenu *tray_menu; GtkWindow *window; gchar *theme_path; /* set ui */ builder = gtk_builder_new(); gtk_builder_add_from_resource(builder, "/ui/calendar.glade", NULL); gtk_builder_connect_signals(builder, NULL); window = GTK_WINDOW(gtk_builder_get_object(builder, "window")); tray_menu = GTK_MENU(gtk_builder_get_object(builder, "tray_menu")); /* set gtkapplication window */ gtk_application_add_window(GTK_APPLICATION(app), window); /* initialize our time */ time_gen(); mytime = today; /* prepare appindicator */ theme_path = g_build_filename(DATADIR, "icons", "hicolor", "256x256", NULL); indicator = app_indicator_new_with_path("Acal", "persian-calendar-1", APP_INDICATOR_CATEGORY_APPLICATION_STATUS, theme_path); app_indicator_set_status(indicator, APP_INDICATOR_STATUS_ACTIVE); app_indicator_set_menu(indicator, tray_menu); /* show initial tray & prepare cal */ update_tray(); cal_gen(); /* add timer to update tray */ g_timeout_add_seconds(3, check_update_tray, (gpointer)indicator); }