コード例 #1
0
static void create_iijmio_indicator(GtkUIManager *ui)
{
  AppIndicator *indicator;
  GtkWidget *indicator_menu;
  GtkIconTheme *theme;
  gchar *current_dir;
  gchar *theme_path;

  indicator = app_indicator_new("iijmio-indicator-client",
                                INDICATOR_ICON,
                                APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
  indicator_menu = gtk_ui_manager_get_widget (ui, "/ui/IndicatorPopup");

  current_dir = g_get_current_dir();
  g_print("%s current_dir:%s\n", G_STRFUNC, current_dir);
  theme_path = g_build_path(G_DIR_SEPARATOR_S,
                            current_dir,
                            "data",
                            NULL);
  g_print("%s path:%s\n", G_STRFUNC, theme_path);
  app_indicator_set_icon_theme_path(indicator,
                                    theme_path);
  g_free(current_dir);
  g_free(theme_path);


  app_indicator_set_status(indicator, APP_INDICATOR_STATUS_ACTIVE);
  app_indicator_set_attention_icon(indicator, INDICATOR_ATTENTION_ICON);

  app_indicator_set_menu(indicator, GTK_MENU(indicator_menu));
  gtk_widget_show_all(indicator_menu);
}
void init_app_indicator(int argc, char **argv) {
    GtkWidget *window;
    
    GError *error = NULL;

    gtk_init (&argc, &argv);

    /* main window  */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    g_signal_connect (G_OBJECT (window),
            "destroy",
            G_CALLBACK (gtk_main_quit),
            NULL);

    /* Indicator */
    indicator = app_indicator_new ("pa-device-switcher-indicator",
            "indicator-messages",
            APP_INDICATOR_CATEGORY_APPLICATION_STATUS);

    menu = gtk_menu_new();
    
    app_indicator_set_status (indicator, APP_INDICATOR_STATUS_ACTIVE);
    app_indicator_set_attention_icon (indicator, "indicator-messages-new");

    app_indicator_set_menu (indicator, GTK_MENU (menu));
}
コード例 #3
0
static void
init_app_indicator (DrWright *dr)
{
    GtkWidget *indicator_menu;

    dr->indicator =
        app_indicator_new_with_path ("typing-break-indicator",
                                     TYPING_MONITOR_ACTIVE_ICON,
                                     APP_INDICATOR_CATEGORY_APPLICATION_STATUS,
                                     IMAGEDIR);
    if (dr->enabled) {
        app_indicator_set_status (dr->indicator,
                                  APP_INDICATOR_STATUS_ACTIVE);
    } else {
        app_indicator_set_status (dr->indicator,
                                  APP_INDICATOR_STATUS_PASSIVE);
    }

    indicator_menu = gtk_ui_manager_get_widget (dr->ui_manager, "/Pop");
    app_indicator_set_menu (dr->indicator, GTK_MENU (indicator_menu));
    app_indicator_set_attention_icon (dr->indicator, TYPING_MONITOR_ATTENTION_ICON);

    update_status (dr);
    update_app_indicator (dr);
}
コード例 #4
0
ファイル: main.c プロジェクト: AlexandroCasanova/ClipIt
void create_app_indicator(gint create) {
	/* Create the menu */
	indicator_menu = create_tray_menu(indicator_menu, 2);
	/* check if we need to create the indicator or just refresh the menu */
	if(create == 1) {
		indicator = app_indicator_new("clipit", "clipit-trayicon", APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
		app_indicator_set_status (indicator, APP_INDICATOR_STATUS_ACTIVE);
		app_indicator_set_attention_icon (indicator, "clipit-trayicon");
	}
	app_indicator_set_menu (indicator, GTK_MENU (indicator_menu));
}
コード例 #5
0
ファイル: indicator.c プロジェクト: kzmkv/indi
static void indicator_init ()
{
	/* TODO: set actual icon */
	Indicator = app_indicator_new (
								   "indi-player",
								   "/usr/share/pixmaps/gnome-xterm.png",
								   APP_INDICATOR_CATEGORY_APPLICATION_STATUS
								   );

	app_indicator_set_attention_icon (Indicator, "indicator-sound");
	app_indicator_set_status (Indicator, APP_INDICATOR_STATUS_ACTIVE);
	//app_indicator_set_label (Indicator, "indi player", NULL);
}
コード例 #6
0
ファイル: indicate.c プロジェクト: jcolag/uManage
void *run_indicator(void *arg) {
    AppIndicator *indicator;
    char          icon[256];

    force = (int *)arg;

    strcpy(icon, pathname);
    strcat(icon, "/clock_ind.png");
    indicator = app_indicator_new("uManage-client", icon,
                                  APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
    app_indicator_set_status(indicator, APP_INDICATOR_STATUS_ACTIVE);
    app_indicator_set_attention_icon(indicator, "indicator-messages-new");

    build_menu(indicator);

    gtk_main ();
    return arg;
}
コード例 #7
0
int main (int argc, char **argv)
{
    /**********************************************************************************/
    /* DAEMON SETUP */

    /* Our process ID and Session ID */
    pid_t pid, sid;

    /* Fork off the parent process */
    pid = fork();
    if (pid < 0) 
        exit(EXIT_FAILURE);

    /* If we got a good PID, then
       we can exit the parent process. */
    if (pid > 0) 
        exit(EXIT_SUCCESS);

    /* Change the file mode mask */
    umask(0);

    /* Open any logs here */        

    /* Create a new SID for the child process */
    sid = setsid();
    if (sid < 0) 
        exit(EXIT_FAILURE);

    /* Change the current working directory */
    if ((chdir("/")) < 0) 
        exit(EXIT_FAILURE);

    /* Close out the standard file descriptors */
    close(STDIN_FILENO);
    close(STDOUT_FILENO);
    close(STDERR_FILENO);

    /**********************************************************************************/
    /* PROGRAM */

    /* define variables gtk*/
    GtkWidget *window;
    GtkWidget *indicator_menu;
    GtkActionGroup *action_group;
    GtkUIManager *uim;
    GError *error = NULL;
    AppIndicator *indicator;
    /* define custum variables */
    int status = atoi(argv[1]);
    
    /* gtk init with no args */
    gtk_init (0, NULL);

    /* main window */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), "Gnus Indicator");
    g_signal_connect (G_OBJECT (window),
                      "destroy",
                      G_CALLBACK (gtk_main_quit),
                      NULL);

    /* Menus */
    action_group = gtk_action_group_new ("AppActions");
    gtk_action_group_add_actions (action_group, entries, n_entries, window);
    uim = gtk_ui_manager_new ();
    gtk_ui_manager_insert_action_group (uim, action_group, 0);
    if (!gtk_ui_manager_add_ui_from_string (uim, ui_info, -1, &error))
    {
        g_message ("Failed to build menus: %s\n", error->message);
        g_error_free (error);
        error = NULL;
    }
    
    /* Indicator */
    indicator_menu = gtk_ui_manager_get_widget (uim, "/ui/IndicatorPopup");

    indicator = app_indicator_new ("example-simple-client",
                                   "/usr/share/pixmaps/gnome-gnus.png",
                                   APP_INDICATOR_CATEGORY_APPLICATION_STATUS);

    app_indicator_set_attention_icon(indicator, "/usr/share/pixmaps/gnome-gnus-new.png");
    app_indicator_set_menu (indicator, GTK_MENU (indicator_menu));
    /* set status */
    if(status == 0)
        app_indicator_set_status (indicator, APP_INDICATOR_STATUS_ACTIVE);
    else if(status == 1)
        app_indicator_set_status (indicator, APP_INDICATOR_STATUS_ATTENTION);
    else
        app_indicator_set_status (indicator, APP_INDICATOR_STATUS_PASSIVE);
    
    gtk_main();

    return 0;
}