예제 #1
0
파일: jse.c 프로젝트: hypersoft/jse
int main(int argc, char *argv[], char *envp[]) {

	void * ctxgroup = (void*)JSTContextGroupCreate();
	JSTContext ctx = JSTContextCreateInGroup(ctxgroup, NULL);
	JSTObject global = JSTContextGetGlobalObject(ctx);
	JSTObject e = NULL; JSTValue *exception = (void*)&e;

	char * appName = g_path_get_basename(argv[0]);
	g_set_application_name(appName);
	g_free(appName);

	JSTInit(global, argc, argv, envp);

	if (ioFileExists(argv[1])) {
		char * script, * src = ioFileReadAllText(argv[1]); script = src; int c = 0;
		if (*script == '#' && *(script+1) == '!') {
			script+=2;
			while ((c = *script) && c != '\n') script++;
		}
		JSTScriptEval(script, NULL, argv[1], 1); g_free(src);
	} else { JSTScriptNativeError(JST_URI_ERROR, "unable to read user script: `%s'", argv[1]); }

	// You've failed young Jedi, Game Over! Finalize methods won't be called!
	if (e) return JSTScriptReportException();
	JSTContextRelease((JSGlobalContextRef)ctx);
	JSTContextGroupRelease(ctxgroup);
	return 0;
}
예제 #2
0
int
main (int argc, char *argv[])
{
  GtkApplication *app;
  GObjectClass *app_class;
  gint retval;

  g_type_init ();

#ifdef HAVE_CHEESE
  /* Used by the avatar chooser */
  g_return_val_if_fail (cheese_gtk_init (&argc, &argv), 1);
#endif

  empathy_init ();

  g_set_application_name (_("Empathy Accounts"));

  /* Make empathy and empathy-accounts appear as the same app in gnome-shell */
  gdk_set_program_class ("Empathy");
  gtk_window_set_default_icon_name ("empathy");

  app = gtk_application_new (EMPATHY_ACCOUNTS_DBUS_NAME, G_APPLICATION_FLAGS_NONE);
  app_class = G_OBJECT_GET_CLASS (app);
  G_APPLICATION_CLASS (app_class)->local_command_line = local_cmdline;
  G_APPLICATION_CLASS (app_class)->activate = app_activate;

  retval = g_application_run (G_APPLICATION (app), argc, argv);

  g_object_unref (app);

  return retval;
}
예제 #3
0
int main(int argc, char **argv)
{
    GladeXML * xml;
    const gchar * url;

    gtk_init(&argc, &argv);
    g_set_application_name("Juniper");

    xml = glade_xml_new("/usr/share/juniper/juniper.glade", NULL, NULL);
    glade_xml_signal_autoconnect(xml);

    if (!(juniper_db_init() && juniper_prefs_init() && juniper_history_init() && juniper_bookmarks_init(xml) && juniper_ui_init(xml) && juniper_tabs_init(xml)))
        return 1;

    url = (argc == 2) ? argv[1] : juniper_prefs_get("homepage");

    if (url)
    {
        juniper_tabs_add_with_location(juniper_util_normalise_url(url));
    }
    else
    {
        juniper_tabs_add();
    }

    gtk_main();

    return 0;
}
예제 #4
0
파일: main.c 프로젝트: kikidong/themanager
int main(int argc, char* argv[])
{
	gettimeofday(&start_time,0);

	g_type_init();
	notify_init(PACKAGE_NAME);

	g_set_application_name("学生成绩管理系统");

	g_log_set_default_handler(myLog,NULL);


	//寻找并打开配置文件

	gkeyfile = g_key_file_new();

	//创建数据库访问对象
	dbclient = sqlconnect_new();
	//设置各种参数

	g_object_set(dbclient, "file", PACKAGE_NAME ".sqlite", NULL);

	//打开数据库
	g_sql_connect_real_connect(dbclient,0);

	//开启服务
	start_server(8000);
	/*主循环*/
	GMainLoop * loop = g_main_loop_new(g_main_context_default(),0);
	g_main_loop_run(loop);
	return 0;
}
예제 #5
0
int main(int argc, char *argv[]) {

    GtkWidget *window;

    gtk_init(&argc, &argv);

    g_set_application_name("This is a test");
    gtk_window_set_default_icon_name("foobar");
    g_setenv("PULSE_PROP_media.role", "phone", TRUE);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW (window), g_get_application_name());
    gtk_widget_show_all(window);

    m = pa_glib_mainloop_new(NULL);
    g_assert(m);

    connect();
    gtk_main();

    pa_context_unref(ctxt);
    pa_glib_mainloop_free(m);

    return 0;
}
int
main (int argc, char *argv[])
{
  ClutterActor *stage         = NULL;

  g_set_application_name ("AtkEditableText");

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  cally_util_a11y_init (&argc, &argv);

  stage = clutter_stage_new ();
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  make_ui (stage);

  clutter_actor_show_all (stage);

  test_atk_text (text_actor);
  test_atk_text (text_editable_actor);

  clutter_main ();

  return 0;
}
예제 #7
0
int main(int argc, char *argv[])
{
	int ret = EXIT_SUCCESS;

	struct credential_operation const *try_op = credential_helper_ops;
	struct credential cred = CREDENTIAL_INIT;

	if (!argv[1]) {
		usage(argv[0]);
		exit(EXIT_FAILURE);
	}

	g_set_application_name("Git Credential Helper");

	/* lookup operation callback */
	while (try_op->name && strcmp(argv[1], try_op->name))
		try_op++;

	/* unsupported operation given -- ignore silently */
	if (!try_op->name || !try_op->op)
		goto out;

	ret = credential_read(&cred);
	if (ret)
		goto out;

	/* perform credential operation */
	ret = (*try_op->op)(&cred);

	credential_write(&cred);

out:
	credential_clear(&cred);
	return ret;
}
int
main                                            (int argc,
                                                 char **argv)
{
    hildon_gtk_init (&argc, &argv);

    HildonProgram *program = hildon_program_get_instance ();
    GtkDrawingArea *area = GTK_DRAWING_AREA (gtk_drawing_area_new ());
    gtk_widget_set_size_request (GTK_WIDGET (area), 320, 240);

    gtk_widget_set_events (GTK_WIDGET (area), 
                           GDK_BUTTON_PRESS_MASK);

    gtk_widget_set_extension_events (GTK_WIDGET (area), GDK_EXTENSION_EVENTS_ALL);
 
    GtkWidget *window = hildon_window_new ();
    hildon_program_add_window (program, HILDON_WINDOW (window));    

    gtk_window_set_title (GTK_WINDOW (window), "world");
    g_set_application_name ("hello");

    gtk_container_set_border_width (GTK_CONTAINER (window), 6);
    
    g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (gtk_main_quit), NULL);
    g_signal_connect (G_OBJECT (area), "button-press-event", G_CALLBACK (on_button_press), NULL);
    gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (area));
    gtk_widget_show_all (GTK_WIDGET (window));
    
    gtk_main ();
    return 0;
}
ZLGtkApplicationWindow::ZLGtkApplicationWindow(ZLApplication *application) :
	ZLApplicationWindow(application),
	KeyActionOnReleaseNotOnPressOption(ZLCategoryKey::CONFIG, "KeyAction", "OnRelease", false),
	myFullScreen(false) {
	myProgram = HILDON_PROGRAM(hildon_program_get_instance());
	g_set_application_name("");

	myWindow = HILDON_WINDOW(hildon_window_new());

	((ZLMaemoCommunicationManager&)ZLCommunicationManager::Instance()).init();

	myToolbar = GTK_TOOLBAR(gtk_toolbar_new());
	gtk_toolbar_set_show_arrow(myToolbar, false);
	gtk_toolbar_set_orientation(myToolbar, GTK_ORIENTATION_HORIZONTAL);
	gtk_toolbar_set_style(myToolbar, GTK_TOOLBAR_ICONS);

	myMenu = GTK_MENU(gtk_menu_new());
	hildon_window_set_menu(myWindow, myMenu);
	gtk_widget_show_all(GTK_WIDGET(myMenu));

	hildon_window_add_toolbar(myWindow, myToolbar);
	hildon_program_add_window(myProgram, myWindow);
	gtk_widget_show_all(GTK_WIDGET(myWindow));

	myViewWidget = 0;

	ZLGtkSignalUtil::connectSignal(GTK_OBJECT(myWindow), "delete_event", GTK_SIGNAL_FUNC(applicationQuit), this);
	ZLGtkSignalUtil::connectSignal(GTK_OBJECT(myWindow), "key_press_event", GTK_SIGNAL_FUNC(handleKeyPress), this);
	ZLGtkSignalUtil::connectSignal(GTK_OBJECT(myWindow), "key_release_event", GTK_SIGNAL_FUNC(handleKeyRelease), this);
}
예제 #10
0
파일: main.c 프로젝트: jdelarosa36/webview
int main(int argc, char *argv[]) {
	pthread_t 		thread;

	/* init threads */
    g_thread_init (NULL);
    gdk_threads_init ();
    gdk_threads_enter ();

    gtk_init(&argc, &argv);

    initApp();

    appdata->program = HILDON_PROGRAM(hildon_program_get_instance());
    g_set_application_name("Webview");

    appdata->window = HILDON_WINDOW(hildon_window_new());
    hildon_program_add_window(appdata->program, appdata->window);


    create_menu(appdata->window);
    build_interface(appdata->window);

    /* Connect signal to X in the upper corner */
    g_signal_connect(G_OBJECT(appdata->window), "delete_event", G_CALLBACK(destroy), NULL);

	update_image();
	load_settings();

	gtk_widget_show_all(GTK_WIDGET(appdata->window));

	if(! start_camera(appdata->window))
	{
		g_warning("Unable to start camera\n");

		GtkWidget *failDialog = gtk_message_dialog_new(NULL,
	     		GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
	     		GTK_BUTTONS_OK,
	     		"Unable to start camera\n");
		gtk_dialog_run (GTK_DIALOG (failDialog));
		gtk_widget_destroy (failDialog);
	}

	if(! start_webserver())
	{
		GtkWidget *failDialog = gtk_message_dialog_new(NULL,
	     		GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
	     		GTK_BUTTONS_OK,
	     		"Unable to start web server.\nCheck server port is not already in use.\n");
		gtk_dialog_run (GTK_DIALOG (failDialog));
		gtk_widget_destroy (failDialog);
	}
	sleep(1);

	pthread_create(&thread, NULL, count_down_thread, NULL);

	gtk_main();

	gdk_threads_leave ();
	return( 0 );
}
예제 #11
0
파일: gtk.c 프로젝트: ginggs/maemo-mtr
void gtk_open(void)
{
  GdkPixbuf *icon;

  int argc;
  char *args[2];
  char **argv;
  argc = 1;
  argv = args;
  argv[0] = "";
  argv[1] = NULL;
  gtk_do_init(&argc, &argv);

  icon = gdk_pixbuf_new_from_xpm_data((const char**)mtr_icon);
  gtk_window_set_default_icon(icon);

  main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  
  g_set_application_name("My traceroute");

  Window_fill(main_window);

  g_signal_connect(GTK_OBJECT(main_window), "delete_event",
                     GTK_SIGNAL_FUNC(Window_destroy), NULL);
  g_signal_connect(GTK_OBJECT(main_window), "destroy",
		     GTK_SIGNAL_FUNC(Window_destroy), NULL);

  gtk_widget_show_all(main_window);
}
예제 #12
0
/**
 * egg_set_desktop_file:
 * @desktop_file_path: path to the application's desktop file
 *
 * Creates an #EggDesktopFile for the application from the data at
 * @desktop_file_path. This will also call g_set_application_name()
 * with the localized application name from the desktop file, and
 * gtk_window_set_default_icon_name() or
 * gtk_window_set_default_icon_from_file() with the application's
 * icon. Other code may use additional information from the desktop
 * file.
 *
 * Note that for thread safety reasons, this function can only
 * be called once.
 **/
void
egg_set_desktop_file (const char *desktop_file_path)
{
  GError *error = NULL;

  G_LOCK (egg_desktop_file);
  if (egg_desktop_file)
    egg_desktop_file_free (egg_desktop_file);

  egg_desktop_file = egg_desktop_file_new (desktop_file_path, &error);
  if (error)
    {
      g_warning ("Could not load desktop file '%s': %s",
		 desktop_file_path, error->message);
      g_error_free (error);
    }

  /* Set localized application name and default window icon */
  if (egg_desktop_file->name)
    g_set_application_name (egg_desktop_file->name);
  if (egg_desktop_file->icon)
    {
      if (g_path_is_absolute (egg_desktop_file->icon))
	gtk_window_set_default_icon_from_file (egg_desktop_file->icon, NULL);
      else
	gtk_window_set_default_icon_name (egg_desktop_file->icon);
    }

  G_UNLOCK (egg_desktop_file);
}
예제 #13
0
파일: main.c 프로젝트: aalex/gtranscoder
int main(int argc, char *argv[])
{
    bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALEDIR);
    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
    textdomain (GETTEXT_PACKAGE);
    
    g_set_application_name (_("Gtranscoder"));

    GtranscoderOptions *options = g_new0(GtranscoderOptions, 1);;
    GOptionEntry entries[] =
    {
        { "verbose", 'v', 0, G_OPTION_ARG_NONE, &options->verbose, N_("Print debug info"), NULL },
        { "version", 'V', 0, G_OPTION_ARG_NONE, &options->show_version, N_("Show version number and exit"), NULL },
        { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, 0 }
    };

    GError *error = NULL;
    GOptionContext *context;
  
    context = g_option_context_new(N_("- Movie transcoding program"));
    g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE);
    g_option_context_add_group (context, gtk_get_option_group (TRUE));
    if (g_option_context_parse(context, &argc, &argv, &error) == FALSE)
    {
        gchar *help_text = g_option_context_get_help (context, TRUE, NULL);
        g_print ("%s\n\n%s", error->message, help_text);
        g_free (help_text);
        g_error_free (error);
        g_option_context_free (context);
        g_free(options);
        return 1;
    }
    if (options->show_version)
    {
        g_print("Gtranscoder " VERSION " \n");
        return 0;
    }

    g_option_context_free (context);
    gtk_init(&argc, &argv);
    
    gboolean has_ffmpeg = check_for_ffmpeg();
    if (! has_ffmpeg)
    {
        gchar *error_mess = N_("Gtranscoder could not find the ffmpeg executable. Aborting.");
        g_critical("%s", error_mess);
        gtranscoder_show_error_dialog_without_main_loop(error_mess);
        g_error("%s", N_("ffmpeg is required."));
        return 1;
    }
    else
    {
        g_debug("%s", N_("Found ffmpeg"));
        run_main_window(options);
        gtk_main();
    }
    g_free(options);
    return 0;
}
예제 #14
0
static gboolean
geyes_applet_fill (MatePanelApplet *applet)
{
	EyesApplet *eyes_applet;
	GtkActionGroup *action_group;
	gchar *ui_path;

	g_set_application_name (_("Eyes"));
	
	gtk_window_set_default_icon_name ("mate-eyes-applet");
	mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
	mate_panel_applet_set_background_widget (applet, GTK_WIDGET (applet));
	
        eyes_applet = create_eyes (applet);

        eyes_applet->timeout_id = g_timeout_add (
		UPDATE_TIMEOUT, (GSourceFunc) timer_cb, eyes_applet);

	action_group = gtk_action_group_new ("Geyes Applet Actions");
	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
	gtk_action_group_add_actions (action_group,
				      geyes_applet_menu_actions,
				      G_N_ELEMENTS (geyes_applet_menu_actions),
				      eyes_applet);
	ui_path = g_build_filename (GEYES_MENU_UI_DIR, "geyes-applet-menu.xml", NULL);
	mate_panel_applet_setup_menu_from_file (eyes_applet->applet,
					   ui_path, action_group);
	g_free (ui_path);

	if (mate_panel_applet_get_locked_down (eyes_applet->applet)) {
		GtkAction *action;

		action = gtk_action_group_get_action (action_group, "Props");
		gtk_action_set_visible (action, FALSE);
	}
	g_object_unref (action_group);

	gtk_widget_set_tooltip_text (GTK_WIDGET (eyes_applet->applet), _("Eyes"));

	set_atk_name_description (GTK_WIDGET (eyes_applet->applet), _("Eyes"), 
			_("The eyes look in the direction of the mouse pointer"));

	g_signal_connect (eyes_applet->vbox,
			  "dispose",
			  G_CALLBACK (dispose_cb),
			  eyes_applet);

	gtk_widget_show_all (GTK_WIDGET (eyes_applet->applet));

	/* setup here and not in create eyes so the destroy signal is set so 
	 * that when there is an error within loading the theme
	 * we can emit this signal */
        if (properties_load (eyes_applet) == FALSE)
		return FALSE;

	setup_eyes (eyes_applet);

	return TRUE;
}
예제 #15
0
static void
init_application_name(void)
{
    const char *application_name = NULL; 
    application_name = g_get_application_name();
    if (!application_name)
        g_set_application_name("Python");
}
예제 #16
0
파일: shared.c 프로젝트: bromeliad/xpstools
void
init (const gchar *prog)
{
	g_type_init ();
	g_set_application_name (prog);
	g_log_set_default_handler (log_func, NULL);
	range = xps_range_new ();
}
예제 #17
0
static void
dss_app_init (DssApp * app)
{
  const gchar *name = "Dual stream switcher";
  g_set_prgname (name);
  g_set_application_name (name);
  gtk_window_set_default_icon_name (name);
  g_application_add_main_option_entries (G_APPLICATION (app), app_options);
}
예제 #18
0
int main(int argc, char * argv[])
{
    enum
    {
        MODE_GET, MODE_SET
    } mode;
    char * name;
    char * password;
    
    g_set_application_name(APPLICATION_NAME);
    
    if (argc != 3)
        usage();
        
    if (g_ascii_strcasecmp(argv[1], "get") == 0)
        mode = MODE_GET;
    else if (g_ascii_strcasecmp(argv[1], "set") == 0)
        mode = MODE_SET;
    else
    {
        fprintf(stderr, "Invalid mode: %s\n", argv[1]);
        exit(EXIT_FAILURE);
    }
    
    name = argv[2];
    
    switch (mode)
    {
        case MODE_GET:
            password = get_password(name);
            if (!password)
            {
                fprintf(stderr, "Failed to get password: %s\n", name);
                exit(EXIT_FAILURE);
            }
            
            puts(password);
            g_free(password);
            break;
            
        case MODE_SET:
            password = g_malloc(MAX_PASSWORD_LENGTH);
            *password = '******';
            fgets(password, MAX_PASSWORD_LENGTH, stdin);
            
            if (!set_password(name, password))
            {
                fprintf(stderr, "Failed to set password: %s\n", name);
                exit(EXIT_FAILURE);
            }
            
            g_free(password);
            break;
    }
    
    return 0;
}
예제 #19
0
파일: main.c 프로젝트: KevinAnthony/rchip
/*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;
}
예제 #20
0
static void
goo_application_startup (GApplication *application)
{
	G_APPLICATION_CLASS (goo_application_parent_class)->startup (application);

	g_set_application_name (_("CD Player"));
	gtk_window_set_default_icon_name ("goobox");

	initialize_app_menu (application);
}
예제 #21
0
void
g_vfs_afp_browse_daemon_init (void)
{
  g_set_application_name (_("Apple Filing Protocol Service"));

#ifdef HAVE_GCRYPT
  gcry_check_version (NULL);
  gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
#endif
}
예제 #22
0
파일: main.c 프로젝트: cristiklein/gthumb
static void
gth_application_init (GthApplication *app)
{
#ifdef GDK_WINDOWING_X11

	GDesktopAppInfo *app_info;

	app_info = g_desktop_app_info_new ("gthumb.desktop");
	if (app_info == NULL)
		return;

	if (g_desktop_app_info_has_key (app_info, "Name")) {
		char *app_name;

		app_name = g_desktop_app_info_get_string (app_info, "Name");
		g_set_application_name (app_name);

		g_free (app_name);
	}

	if (g_desktop_app_info_has_key (app_info, "Icon")) {
		char *icon;

		icon = g_desktop_app_info_get_string (app_info, "Icon");
		if (g_path_is_absolute (icon))
			gtk_window_set_default_icon_from_file (icon, NULL);
		else
			gtk_window_set_default_icon_name (icon);

		g_free (icon);
	}

	g_object_unref (app_info);

#else

	/* manually set name and icon */

	g_set_application_name (_("gThumb"));
	gtk_window_set_default_icon_name ("gthumb");

#endif
}
예제 #23
0
static gboolean
applet_factory (MatePanelApplet *applet,
		const char  *iid,
		gpointer     user_data)
{
    gboolean ret = FALSE;
    GtkWidget *drive_list;
    AtkObject *ao;
    GtkActionGroup *action_group;
    gchar *ui_path;

    if (!strcmp (iid, drivemount_iid)) {
	g_set_application_name (_("Disk Mounter"));

	gtk_window_set_default_icon_name ("media-floppy");

	mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
	mate_panel_applet_set_background_widget (applet, GTK_WIDGET (applet));

	drive_list = drive_list_new ();
	gtk_container_add (GTK_CONTAINER (applet), drive_list);

	g_signal_connect_object (applet, "change_orient",
				 G_CALLBACK (change_orient), drive_list, 0);
	g_signal_connect_object (applet, "size_allocate",
				 G_CALLBACK (size_allocate), drive_list, 0);
	g_signal_connect (applet, "change_background",
			  G_CALLBACK (change_background), drive_list);

	/* set initial state */
	change_orient (applet,
		       mate_panel_applet_get_orient (applet),
		       DRIVE_LIST (drive_list));

	action_group = gtk_action_group_new ("DriveMount Applet Actions");
	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
	gtk_action_group_add_actions (action_group,
				      applet_menu_actions,
				      G_N_ELEMENTS (applet_menu_actions),
				      drive_list);
	ui_path = g_build_filename (DRIVEMOUNT_MENU_UI_DIR, "drivemount-applet-menu.xml", NULL);
	mate_panel_applet_setup_menu_from_file (applet, ui_path, action_group);
	g_free (ui_path);
	g_object_unref (action_group);

	ao = gtk_widget_get_accessible (GTK_WIDGET (applet));
	atk_object_set_name (ao, _("Disk Mounter"));

	gtk_widget_show_all (GTK_WIDGET (applet));

	ret = TRUE;
    }

    return ret;
}
예제 #24
0
gint
main (gint argc,
      gchar *argv[])
{
  g_autoptr(GDBusConnection) connection = NULL;
  g_autoptr(IpcGitService) service = NULL;
  g_autoptr(GOutputStream) stdout_stream = NULL;
  g_autoptr(GInputStream) stdin_stream = NULL;
  g_autoptr(GIOStream) stream = NULL;
  g_autoptr(GMainLoop) main_loop = NULL;
  g_autoptr(GError) error = NULL;

  g_set_prgname ("gnome-builder-git");
  g_set_application_name ("gnome-builder-git");

  prctl (PR_SET_PDEATHSIG, SIGTERM);

  signal (SIGPIPE, SIG_IGN);

  ggit_init ();

  g_log_set_handler (NULL, G_LOG_LEVEL_MASK, log_func, NULL);

  if (!g_unix_set_fd_nonblocking (STDIN_FILENO, TRUE, &error) ||
      !g_unix_set_fd_nonblocking (STDOUT_FILENO, TRUE, &error))
    goto error;

  main_loop = g_main_loop_new (NULL, FALSE);
  stdin_stream = g_unix_input_stream_new (STDIN_FILENO, FALSE);
  stdout_stream = g_unix_output_stream_new (STDOUT_FILENO, FALSE);
  stream = g_simple_io_stream_new (stdin_stream, stdout_stream);

  if (!(connection = create_connection (stream, main_loop, &error)))
    goto error;

  service = ipc_git_service_impl_new ();

  if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (service),
                                         connection,
                                         "/org/gnome/Builder/Git",
                                         &error))
    goto error;

  g_dbus_connection_start_message_processing (connection);
  g_main_loop_run (main_loop);

  return EXIT_SUCCESS;

error:
  if (error != NULL)
    g_printerr ("%s\n", error->message);

  return EXIT_FAILURE;
}
예제 #25
0
int main(int argc, char **argv)
{
	gtk_init(&argc, &argv);
	gtk_rc_parse("style.rc");
	g_set_application_name("Nonlogic Project");

	desktop_show();	
	
	gtk_main();
	return 0;
}
예제 #26
0
// Initial function that draws the applet
static gboolean windowtitle_applet_factory (PanelApplet *applet, const gchar *iid, gpointer data) {
	if (strcmp (iid, APPLET_OAFIID) != 0) return FALSE;
	
	g_set_application_name (APPLET_NAME); //GLib-WARNING **: g_set_application_name() called multiple times
	panel_applet_add_preferences (applet, GCONF_PREFS, NULL);
	wnck_set_client_type (WNCK_CLIENT_TYPE_PAGER);

	init_wtapplet (applet);

	return TRUE;
}
예제 #27
0
TwituxApp *
twitux_app_new (void)
{
  g_type_init ();

  g_set_application_name ("Twitux");

  return g_object_new (twitux_app_get_type (),
                       "application-id", APP_SERVICE_NAME,
                       NULL);
}
예제 #28
0
파일: main.c 프로젝트: cpaasch/simon
int main(int argc, char *argv[]) {


	GtkWidget *dialog;
	GtkWidget *dialog_wrapper;
	GtkWidget *select_interfaces_label;
  GtkWidget *ready_button;
  Interface_list interfaces;
  int i;

	gtk_init(&argc, &argv);
	g_set_application_name("Traffic Monitor");


	/* Asking for interfaces to display */

	dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	dialog_wrapper = gtk_vbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER (dialog), dialog_wrapper);

  select_interfaces_label = gtk_label_new("Select interfaces to display:");
  gtk_box_pack_start(GTK_BOX(dialog_wrapper), select_interfaces_label, FALSE, FALSE, 0);

  interfaces = get_full_iflist();
  interfaces.dialog = dialog;

  for(i = 0; i < interfaces.len; i++) {
    GtkWidget *select = gtk_check_button_new_with_label(interfaces.interface[i].ifname);
    interfaces.interface[i].select_widget = select;
    gtk_box_pack_start(GTK_BOX(dialog_wrapper), select, FALSE, FALSE, 0);
  }

  ready_button = gtk_button_new_with_label("Draw!");
  gtk_box_pack_start(GTK_BOX(dialog_wrapper), ready_button, FALSE, FALSE, 0);


  g_signal_connect (ready_button, "clicked",
          G_CALLBACK (interfaces_selected), (gpointer) &interfaces);
  g_signal_connect (dialog, "destroy",
              G_CALLBACK (destroy), NULL);


  gtk_widget_show_all(dialog_wrapper);
  gtk_widget_show(GTK_WIDGET(dialog));

	//printf("Active interfaces: %d\n", nif);


	gtk_main();

	gtk_exit(0);

	return EXIT_SUCCESS;
}
예제 #29
0
BrioApplication *
brio_application_new (void)
{
  g_type_init ();

  g_set_application_name ("Brio");

  return g_object_new (brio_application_get_type (),
                       "application-id", "org.gnome.Brio",
                       NULL);
}
/* Create and initalize global sticky notes instance */
void
stickynotes_applet_init (PanelApplet *panel_applet)
{
	stickynotes = g_new(StickyNotes, 1);

	stickynotes->notes = NULL;
	stickynotes->applets = NULL;
	stickynotes->last_timeout_data = 0;

	g_set_application_name (_("Sticky Notes"));

	/* Register size for icons */
	gtk_icon_size_register ("stickynotes_icon_size", 8,8);

	gtk_window_set_default_icon_name ("consort-sticky-notes-applet");

	stickynotes->icon_normal = gtk_icon_theme_load_icon (
			gtk_icon_theme_get_default (),
			"consort-sticky-notes-applet",
			48, 0, NULL);

	stickynotes->icon_prelight = gdk_pixbuf_new (
			gdk_pixbuf_get_colorspace (stickynotes->icon_normal),
			gdk_pixbuf_get_has_alpha (stickynotes->icon_normal),
			gdk_pixbuf_get_bits_per_sample (
				stickynotes->icon_normal),
			gdk_pixbuf_get_width (stickynotes->icon_normal),
			gdk_pixbuf_get_height (stickynotes->icon_normal));
	stickynotes_make_prelight_icon (stickynotes->icon_prelight,
			stickynotes->icon_normal, 30);
	stickynotes->gconf = gconf_client_get_default();
	stickynotes->visible = TRUE;

	stickynotes_applet_init_icons();
	stickynotes_applet_init_prefs();

	/* Watch GConf values */
	gconf_client_add_dir (stickynotes->gconf, GCONF_PATH,
			GCONF_CLIENT_PRELOAD_NONE, NULL);
	gconf_client_notify_add (stickynotes->gconf, GCONF_PATH "/defaults",
			(GConfClientNotifyFunc) preferences_apply_cb,
			NULL, NULL, NULL);
	gconf_client_notify_add (stickynotes->gconf, GCONF_PATH "/settings",
			(GConfClientNotifyFunc) preferences_apply_cb,
			NULL, NULL, NULL);

	/* Max height for large notes*/
	stickynotes->max_height = 0.8*gdk_screen_get_height( gdk_screen_get_default() );

	/* Load sticky notes */
	stickynotes_load (gtk_widget_get_screen (GTK_WIDGET (panel_applet)));

	install_check_click_on_desktop ();
}