static void glade_app_init (GladeApp *app) { static gboolean initialized = FALSE; GladeAppPrivate *priv = app->priv = glade_app_get_instance_private (app); singleton_app = app; glade_init (); if (!initialized) { gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), pixmaps_dir); glade_cursor_init (); initialized = TRUE; } priv->accel_group = NULL; /* Initialize app objects */ priv->catalogs = (GList *) glade_catalog_load_all (); /* Create clipboard */ priv->clipboard = glade_clipboard_new (); /* Load the configuration file */ priv->config = g_key_file_ref (glade_app_get_config ()); }
static void explorer_class_init(ExplorerClass *klass) { GObjectClass *object_class = (GObjectClass*) klass; object_class->dispose = explorer_dispose; glade_init(); }
int main(int argc, const char **argv) { //bionet sure has a lot of debug messages... silence them //TODO: write bionet debugs to a file?? //g_log_set_default_handler(null_log_handler, NULL); // standard gtk+ init, followed by a glade init // cast the argvp because gtk_init doesn't want a const // and everything else does */ gtk_init(&argc, &argv); glade_init(); //once the ui has been inited, the cond is broadcast and we are ready to run gui_gtk_run(&argc, &argv); char *hostname = NULL; if(argc > 1) { hostname = argv[1]; printf("Using host: %s\n", hostname); } //prime the bionet connection, wait on a cond bionet_interface_main(hostname); gtk_main(); return 0; }
static void e_table_config_class_init (ETableConfigClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); klass->changed = NULL; object_class->finalize = config_finalize; object_class->get_property = config_get_property; e_table_config_signals [CHANGED] = g_signal_new ("changed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ETableConfigClass, changed), (GSignalAccumulator) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); g_object_class_install_property (object_class, PROP_STATE, g_param_spec_object ("state", _("State"), /*_( */"XXX blurb" /*)*/, E_TABLE_STATE_TYPE, G_PARAM_READABLE)); glade_init (); }
int main(int argc, char *argv[]) { GtkWidget *gmdb; GnomeProgram *program; #ifdef SQL /* initialize the SQL engine */ sql = mdb_sql_init(); #endif /* initialize MDB Tools library */ mdb_init(); /* Initialize GNOME */ /* Initialize gnome program */ program = gnome_program_init ("gmdb", "0.2", LIBGNOMEUI_MODULE, argc, argv, GNOME_PARAM_POPT_TABLE, NULL, GNOME_PARAM_HUMAN_READABLE_NAME, _("Gnome-MDB File Viewer"), GNOME_PARAM_APP_DATADIR, DATADIR, NULL); //gnome_init ("gmdb", "0.2", argc, argv); //app = gnome_app_new ("gmdb", "Gnome-MDB File Viewer"); glade_init(); /* load the interface */ mainwin_xml = glade_xml_new(GMDB_GLADEDIR "gmdb.glade", NULL, NULL); /* connect the signals in the interface */ glade_xml_signal_autoconnect(mainwin_xml); gmdb = glade_xml_get_widget (mainwin_xml, "gmdb"); gtk_signal_connect (GTK_OBJECT (gmdb), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL); //gmdb_load_icons(mainwin_xml); if (argc>1) { gmdb_file_open(argv[1]); } else { gmdb_reset_widgets(); } gmdb_load_recent_files(); gmdb_init_popups(); /* start the event loop */ gtk_main(); #ifdef SQL /* free MDB Tools library */ mdb_sql_exit(sql); #endif mdb_exit(); return 0; }
int main(int argc, char **argv) { gtk_init(&argc, &argv); glade_init(); uv_gtk_env = init_uv(); init_abacus(uv_gtk_env); if (argc == 2) open_file(argv[1]); show_main(); gtk_main(); return (0); }
/* ** Load and set up GUI with libglade */ GtkWidget *InitTestMEdWindow( void ) { GtkWidget *win=NULL, *frame=NULL; GladeXML *xml=NULL; char *rootnode=NULL; // This is probably never needed errormsg(MAPDEBUG1,"InitTestMEdWindow: Entered"); glade_init(); errormsg(MAPDEBUG4,"InitTestMEdWindow: glade_init done"); xml = glade_xml_new(TESTMAPEDITFILE, rootnode); errormsg(MAPDEBUG4,"InitTestMEdWindow: glade_xml_new done"); if (!xml) { g_warning("something bad happened while creating the interface"); CloseAll(); exit(20); } if (rootnode) // Probably never needed { GtkWidget *wid = glade_xml_get_widget(xml, rootnode); if (!GTK_IS_WINDOW(wid)) { win = gtk_window_new(GTK_WINDOW_TOPLEVEL); errormsg(MAPDEBUG3,"InitTestMEdWindow: win=%x",win); gtk_signal_connect(GTK_OBJECT(win), "destroy", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); gtk_container_set_border_width(GTK_CONTAINER(win), 5); frame = gtk_frame_new(NULL); gtk_container_set_border_width(GTK_CONTAINER(frame), 5); gtk_container_add(GTK_CONTAINER(win), frame); gtk_widget_show(frame); gtk_container_add(GTK_CONTAINER(frame), wid); gtk_widget_show(win); } else win=wid; } // Connect signals errormsg(MAPDEBUG3,"InitTestMEdWindow: win=%x",win); glade_xml_signal_autoconnect(xml); gtk_object_unref(GTK_OBJECT(xml)); errormsg(MAPDEBUG3,"InitTestMEdWindow: win=%x now!",win); errormsg(MAPDEBUG1,"InitTestMEdWindow: Finished succesfully"); return win; // Problem: We never get a window pointer ? }
static void animation_render_ui_class_init(AnimationRenderUiClass *klass) { GObjectClass *object_class = (GObjectClass*) klass; object_class->dispose = animation_render_ui_dispose; animation_render_ui_signals[CLOSED_SIGNAL] = g_signal_new("closed", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(AnimationRenderUiClass, animation_render_ui), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); glade_init(); }
int main(int argc, char **argv) { int valor; guint timer = 1000; #if OPCIONES_LINEA const GOptionEntry entries[] = { { "timer", 't', 0, G_OPTION_ARG_INT, &timer, "Establece el intervalo del temporizador generador de ciclos, en milisegundos", "T" }, { NULL } }; GOptionContext* contexto = g_option_context_new (" <pipeline> - ejecuta un pipeline definido en un XML válido"); g_option_context_add_main_entries (contexto, entries, 0); g_option_context_add_group (contexto, gtk_get_option_group (TRUE)); g_option_context_parse (contexto, &argc, &argv, 0); g_option_context_set_help_enabled (contexto, TRUE); #endif if (argc < 2) { printf("Faltan argumentos. Uso: %s <pipeline>.\n", argv[0]); return -1; } else { gtk_init(&argc, &argv); glade_init(); xml = glade_xml_new("ventana_pipeline.glade", NULL, NULL); glade_xml_signal_autoconnect(xml); pipeline_t * p = pipeline_cargar(argv[1], g_get_current_dir(), funcion_error); if(p) { g_timeout_add(timer, tick, p); pipeline_iniciar(p); gtk_main(); pipeline_borrar(p); valor = 0; } else { valor = -1; } } #if OPCIONES_LINEA g_option_context_free(contexto); #endif return valor; }
int main(int argc, char **argv) { PppStatus *s; GnomeProgram *app; app = gnome_program_init("gnome-pppoe", "1.0", LIBGNOMEUI_MODULE, argc, argv, NULL, NULL); gtk_init(NULL, NULL); glade_init(); s = ppp_status_new("../glade/libpppd-gnome.glade", "pppoe", "/apps/gnome-pppoe/use_tray"); g_signal_connect(s,"stopped", G_CALLBACK(on_stopped), NULL); g_signal_connect(s,"about", G_CALLBACK(on_about), NULL); ppp_status_attach(s); gdk_threads_enter(); gtk_main(); gdk_threads_leave(); g_thread_exit(NULL); return 0; }
int main (int argc, char *argv[]) { GladeXML *xml; gtk_init(&argc, &argv); glade_init(); xml = glade_xml_new("basic.glade", NULL); if (!xml) { g_warning("something bad happened while creating the interface"); return 1; } glade_xml_signal_autoconnect(xml); gtk_main (); return 0; }
int main (int argc, char *argv[]) { PREFS images; /* Create preferences object */ gchar *window_name; /* String to hold window's name */ gchar *xmlpath; /* Path to Glade's XML file */ gchar *iconpath; /* Path to MESSyFront's icon */ gtk_init (&argc, &argv); /* Initialize GTK */ glade_init (); /* Initialize Glade */ /* Create Glade Interface */ xmlpath = g_strjoin (DIR_SEP, INSTALL_PREFIX, XML_DIRECTORY, XML_FILENAME, NULL); images.xml = glade_xml_new (xmlpath, NULL, NULL); if (!images.xml) { g_warning ("MESSYFRONT: Unable to create interface with libglade!"); exit (EXIT_FAILURE); } /* Connect homemade signals */ connect_signals (&images); /* Connect Glade-made signals */ glade_xml_signal_autoconnect (images.xml); /* Set window's name and icon */ window_name = g_strjoin (" ", MESSY_APP_NAME, MESSY_VERSION, NULL); change_window_name (&images, window_name); iconpath = g_strjoin (DIR_SEP, INSTALL_PREFIX, ICON_PATH, ICON_NAME, NULL); change_window_icon (&images, iconpath); get_prefs_from_file (&images); /* Get user's preferences */ populate_object_from_fields (&images); /* Initialize object "images" */ gtk_main (); /* Start the main event loop */ return EXIT_SUCCESS; /* End of story. */ }
int main (int argc, char *argv[]) { GList *adaptors, *l; gtk_test_init (&argc, &argv, NULL); glade_init (); glade_app_get (); adaptors = g_list_sort (glade_widget_adaptor_list_adaptors (), adaptor_cmp); for (l = adaptors; l; l = l->next) { GladeWidgetAdaptor *adaptor = l->data; GType adaptor_type; adaptor_type = glade_widget_adaptor_get_object_type (adaptor); if (G_TYPE_IS_INSTANTIATABLE (adaptor_type) && !G_TYPE_IS_ABSTRACT (adaptor_type) && /* FIXME: FileChooserButton leaks a GTask which will crash in the following test */ adaptor_type != GTK_TYPE_FILE_CHOOSER_BUTTON && /* FIXME: GtkRecentChooser tries to remove an unknown source id */ !g_type_is_a (adaptor_type, GTK_TYPE_RECENT_CHOOSER)) { gchar *test_path = g_strdup_printf ("/CreateWidget/%s", glade_widget_adaptor_get_name (adaptor)); g_test_add_data_func (test_path, adaptor, test_create_widget); g_free (test_path); } } g_list_free (adaptors); return g_test_run (); }
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_init(&argc, &argv); glade_init(); gnome_program_init(PACKAGE, VERSION, LIBGNOME_MODULE, argc, argv, GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR, GNOME_PARAM_HUMAN_READABLE_NAME, _("Font Manager"), NULL); gtk_about_dialog_set_url_hook((GtkAboutDialogActivateLinkFunc)fm_url_hook, NULL, NULL); glade_set_custom_handler((GladeXMLCustomWidgetHandler)fm_glade_helper, NULL); gtk_widget_show(fm_window_new()); gtk_main(); return 0; }
/*! \brief main() is the typical main function in a C program, it performs all core initialization, loading of all main parameters, initializing handlers and entering gtk_main to process events until program close \param argc is the count of command line arguments \param argv is the array of command line args \returns TRUE */ gint main(gint argc, gchar ** argv) { Serial_Params *serial_params = NULL; GAsyncQueue *queue = NULL; GTimer *timer = NULL; GCond *rtv_thread_cond = NULL; GMutex *dash_mutex = NULL; GMutex *rtt_mutex = NULL; GMutex *rtv_mutex = NULL; GMutex *rtv_thread_mutex = NULL; GMutex *serio_mutex = NULL; gint id = 0; setlocale(LC_ALL,""); #ifdef __WIN32__ bindtextdomain(PACKAGE, "C:\\Program Files\\MegaTunix\\dist\\locale"); #else bindtextdomain(PACKAGE, LOCALEDIR); #endif textdomain (PACKAGE); #ifdef DEBUG printf("This is a debug release, Git hash: %s\n",GIT_HASH); #endif // Not needed? // gdk_threads_init(); gtk_init(&argc, &argv); glade_init(); /* Check if OpenGL is supported. */ if (gdk_gl_query() == FALSE) { g_print("OpenGL not supported\n"); return 0; } else gl_ability = TRUE; // gdk_gl_init_check(&argc, &argv); // gl_ability = gtk_gl_init_check(&argc, &argv); global_data = g_new0(gconstpointer, 1); /* Condition Variables */ rtv_thread_cond = g_new0(GCond,1); g_cond_init(rtv_thread_cond); DATA_SET(global_data,"rtv_thread_cond",rtv_thread_cond); /* Mutexes */ dash_mutex = g_new0(GMutex, 1); g_mutex_init(dash_mutex); DATA_SET(global_data,"dash_mutex",dash_mutex); rtt_mutex = g_new0(GMutex, 1); g_mutex_init(rtt_mutex); DATA_SET(global_data,"rtt_mutex",rtt_mutex); rtv_mutex = g_new0(GMutex, 1); g_mutex_init(rtv_mutex); DATA_SET(global_data,"rtv_mutex",rtv_mutex); rtv_thread_mutex = g_new0(GMutex, 1); g_mutex_init(rtv_thread_mutex); DATA_SET(global_data,"rtv_thread_mutex",rtv_thread_mutex); serio_mutex = g_new0(GMutex, 1); g_mutex_init(serio_mutex); DATA_SET(global_data,"serio_mutex",serio_mutex); /* For testing if gettext works printf(_("Hello World!\n")); */ /* Build table of strings to enum values */ build_string_2_enum_table(); serial_params = (Serial_Params *)g_malloc0(sizeof(Serial_Params)); DATA_SET(global_data,"serial_params",serial_params); handle_args(argc,argv); /* handle CLI arguments */ /* This will exit mtx if the locking fails! */ /* Prevents multiple instances but stops esoteric usess too * create_mtx_lock(); * */ open_debug(); /* Open debug log */ ENTER(); /* Allocate memory */ init(); /* Initialize global vars */ make_mtx_dirs(); /* Create config file dirs if missing */ /* Create Message passing queues */ queue = g_async_queue_new(); DATA_SET_FULL(global_data,"io_data_queue",queue,g_async_queue_unref); queue = g_async_queue_new(); DATA_SET_FULL(global_data,"slave_msg_queue",queue,g_async_queue_unref); queue = g_async_queue_new(); DATA_SET_FULL(global_data,"io_repair_queue",queue,g_async_queue_unref); read_config(); setup_gui(); gtk_rc_parse_string("style \"override\"\n{\n\tGtkTreeView::horizontal-separator = 0\n\tGtkTreeView::vertical-separator = 0\n}\nwidget_class \"*\" style \"override\""); /* This doesn't do any GUI stuff so can run as is... */ id = g_timeout_add(2000,(GSourceFunc)flush_binary_logs,NULL); DATA_SET(global_data,"binlog_flush_id",GINT_TO_POINTER(id)); sleep_calib(); /* Check for first_time flag, if so, run first time wizard, otherwise load personality choice */ timer = g_timer_new(); DATA_SET_FULL(global_data,"mtx_uptime_timer",timer,g_timer_destroy); g_idle_add((GSourceFunc)check_for_first_time,NULL); DATA_SET(global_data,"ready",GINT_TO_POINTER(TRUE)); gdk_threads_enter(); gtk_main(); gdk_threads_leave(); EXIT(); return (0); }
/* Run a GUI to select and uninstall products */ int uninstall_ui(int argc, char *argv[]) { GtkWidget *window; GtkWidget *widget; GtkWidget *frame; GtkWidget *vbox; GtkWidget *button; GtkWidget *label; const char *product_name; product_t *product; product_info_t *product_info; product_component_t *component; component_list *component_list, *addon_list; char text[1024]; #ifdef ENABLE_GTK2 // Turn off any themes setenv("GTK2_RC_FILES", "", 1); setenv("GTK_DATA_PREFIX", "", 1); #endif gtk_init(&argc,&argv); /* Disable GLib warnings that may be triggered by libglade */ g_log_set_handler ("libglade", G_LOG_LEVEL_WARNING | G_LOG_FLAG_RECURSION, log_handler, NULL); /* Initialize Glade */ glade_init(); uninstall_glade = GLADE_XML_NEW(DATADIR "/" UNINSTALL_GLADE, "loki_uninstall"); /* Add all signal handlers defined in glade file */ glade_xml_signal_autoconnect(uninstall_glade); /* Make sure the window is visible */ widget = glade_xml_get_widget(uninstall_glade, "uninstall_button"); if ( widget ) { gtk_button_set_sensitive(widget, FALSE); } window = glade_xml_get_widget(uninstall_glade, "loki_uninstall"); gtk_widget_realize(window); while( gtk_events_pending() ) { gtk_main_iteration(); } /* Add emergency signal handlers */ signal(SIGHUP, main_signal_abort); signal(SIGINT, main_signal_abort); signal(SIGQUIT, main_signal_abort); signal(SIGTERM, main_signal_abort); /* Fill in the list of products and components */ widget = glade_xml_get_widget(uninstall_glade, "uninstall_vbox"); if ( ! widget ) { fprintf(stderr, _("No uninstall_vbox in glade file!\n")); return(-1); } gtk_container_foreach(GTK_CONTAINER(widget), empty_container, widget); for ( product_name=loki_getfirstproduct(); product_name; product_name=loki_getnextproduct() ) { /* See if we can open the product */ product = loki_openproduct(product_name); if ( ! product ) { continue; } /* See if we have permissions to remove the product */ product_info = loki_getinfo_product(product); if ( ! check_permissions(product_info, 0) ) { loki_closeproduct(product); continue; } /* Add the product and components to our list */ strncpy(text, product_info->description, sizeof(text)); frame = gtk_frame_new(text); gtk_container_set_border_width(GTK_CONTAINER(frame), 4); gtk_box_pack_start(GTK_BOX(widget), frame, FALSE, TRUE, 0); gtk_widget_show(frame); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show(vbox); component = loki_getdefault_component(product); component_list = NULL; if ( component ) { component_list = create_component_list(product, product_info, component); strncpy(text, _("Complete uninstall"), sizeof(text)); button = gtk_check_button_new_with_label(text); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(button), "toggled", GTK_SIGNAL_FUNC(component_toggled_slot), (gpointer)component_list); gtk_object_set_data(GTK_OBJECT(button), "data", (gpointer)component_list); gtk_widget_show(button); } for ( component = loki_getfirst_component(product); component; component = loki_getnext_component(component) ) { if ( loki_isdefault_component(component) ) { continue; } addon_list = create_component_list(product, product_info, component); strncpy(text, loki_getname_component(component), sizeof(text)); button = gtk_check_button_new_with_label(text); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(button), "toggled", GTK_SIGNAL_FUNC(component_toggled_slot), (gpointer)addon_list); gtk_object_set_data(GTK_OBJECT(button), "data", (gpointer)addon_list); gtk_widget_show(button); add_component_list(component_list, button); } /* Add this product to our list of open products */ add_product(product); } /* Check to make sure there's something to uninstall */ if ( ! product_list ) { label = gtk_label_new( _("No products were installed by this user.\n" "You may need to run this tool as an administrator.")); gtk_box_pack_start(GTK_BOX(widget), label, FALSE, TRUE, 0); gtk_widget_show(label); } /* Run the UI.. */ gtk_main(); /* Close all the products and return */ close_products(0); return 0; }
int main(int argc, char *argv[]) { char option[2]; int n; int err=0; if(!argc) usage(argv[0]); clone_args( argv, argc ); #if !GLIB_CHECK_VERSION(2,36,0) g_type_init(); #endif gtk_init( &argc, &argv ); // default host to connect to snprintf(hostname,sizeof(hostname), "127.0.0.1"); while( ( n = getopt( argc, argv, "s:h:p:tabnvLHfX:P:Vl:T:m:g:")) != EOF ) { sprintf(option, "%c", n ); err += set_option( option, optarg); if(err) usage(argv[0]); } if( optind > argc ) err ++; if( err ) usage(argv[0]); glade_init(); vj_mem_init(); vevo_strict_init(); find_user_themes(gveejay_theme); vj_gui_set_debug_level( verbosity , n_tracks,0,0); set_skin( selected_skin, gveejay_theme ); default_bank_values( &col, &row ); gui_load_theme(); register_signals(); vj_gui_init( skins[selected_skin].file, launcher, hostname, port_num, use_threads, load_midi, midi_file,beta,auto_connect); vj_gui_style_setup(); if( preview ) { veejay_msg(VEEJAY_MSG_INFO, "Starting with preview enabled"); gveejay_preview(preview); } if( launcher ) { reloaded_launcher( hostname, port_num ); } memset( &time_last_, 0, sizeof(struct timeval)); while(gveejay_running()) { if(gveejay_idle(NULL)==FALSE) break; while( gtk_events_pending() ) gtk_main_iteration(); } veejay_msg(VEEJAY_MSG_INFO, "See you!"); return 0; }
int main(int argc, char **argv) { GtkWidget *w; int i; char str[1025]; char flags[33]; GtkListStore *lstore = NULL; GtkTreeSelection *lsel; char glade_path[MAX_PATH+1]; char *p; gtk_init(&argc, &argv); glade_init(); /* Read .cfg files here */ memset(&cfg,0,sizeof(cfg)); p=getenv("SBBSCTRL"); if(p==NULL) { display_message("Environment Error","SBBSCTRL not set","gtk-dialog-error"); return(-1); } SAFECOPY(cfg.ctrl_dir, p); prep_dir("",cfg.ctrl_dir,sizeof(cfg.ctrl_dir)); if(!isdir(cfg.ctrl_dir)) { display_message("Environment Error","SBBSCTRL does not point to a directory","gtk-dialog-error"); return(-1); } cfg.size=sizeof(cfg); if(!load_cfg(&cfg, NULL, TRUE, str)) { fprintf(stderr,"Cannot load configuration data (%s)",str); return; } /* load the interface */ strcpy(glade_path, argv[0]); strcpy(getfname(glade_path), "gtkuserlist.glade"); lxml = glade_xml_new(glade_path, "UserListWindow", NULL); if(lxml==NULL) { fprintf(stderr,"Could not locate UserListWindow widget\n"); return; } /* connect the signals in the interface */ glade_xml_signal_autoconnect(lxml); /* Set up user list */ w=glade_xml_get_widget(lxml, "lUserList"); lstore = gtk_list_store_new(17 ,G_TYPE_INT ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_INT ,G_TYPE_INT ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_INT ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_INT ,G_TYPE_INT ); gtk_tree_view_set_model(GTK_TREE_VIEW(w), GTK_TREE_MODEL(lstore)); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,0 ,"Num" ,gtk_cell_renderer_text_new() ,"text" ,0 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 0 ) ,0 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,1 ,"Alias" ,gtk_cell_renderer_text_new() ,"text" ,1 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 1 ) ,1 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,2 ,"Name" ,gtk_cell_renderer_text_new() ,"text" ,2 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 2 ) ,2 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,3 ,"Lev" ,gtk_cell_renderer_text_new() ,"text" ,3 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 3 ) ,3 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,4 ,"Age" ,gtk_cell_renderer_text_new() ,"text" ,4 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 4 ) ,4 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,5 ,"Sex" ,gtk_cell_renderer_text_new() ,"text" ,5 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 5 ) ,5 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,6 ,"Location" ,gtk_cell_renderer_text_new() ,"text" ,6 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 6 ) ,6 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,7 ,"Protocol" ,gtk_cell_renderer_text_new() ,"text" ,7 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 7 ) ,7 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,8 ,"Address" ,gtk_cell_renderer_text_new() ,"text" ,8 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 8 ) ,8 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,9 ,"Host Name" ,gtk_cell_renderer_text_new() ,"text" ,9 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 9 ) ,9 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,10 ,"Phone" ,gtk_cell_renderer_text_new() ,"text" ,10 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 10 ) ,10 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,11 ,"Email" ,gtk_cell_renderer_text_new() ,"text" ,11 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 11 ) ,11 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,12 ,"Logons" ,gtk_cell_renderer_text_new() ,"text" ,12 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 12 ) ,12 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,13 ,"First On" ,gtk_cell_renderer_text_new() ,"text" ,13 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 13 ) ,15 ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(w) ,14 ,"Last On" ,gtk_cell_renderer_text_new() ,"text" ,14 ,NULL); gtk_tree_view_column_set_sort_column_id( gtk_tree_view_get_column( GTK_TREE_VIEW(w), 14 ) ,16 ); lsel = gtk_tree_view_get_selection (GTK_TREE_VIEW (w)); gtk_tree_selection_set_mode (lsel, GTK_SELECTION_MULTIPLE); g_signal_connect (G_OBJECT (lsel), "changed", G_CALLBACK (update_userlist_sensitive_callback), NULL); /* Set up users */ update_userlist_callback(GTK_WIDGET(w), NULL); update_userlist_sensitive_callback(lsel, NULL); /* Set up quick validation values */ w=glade_xml_get_widget(lxml, "cQuickValidate"); gtk_combo_box_set_active(GTK_COMBO_BOX(w), 0); for(i=0;i<10;i++) { sprintf(str,"%d SL: %-2d F1: %s",i,cfg.val_level[i],ltoaf(cfg.val_flags1[i],flags)); gtk_combo_box_append_text(GTK_COMBO_BOX(w), str); } /* Show 'er to the user */ gtk_window_present(GTK_WINDOW(glade_xml_get_widget(lxml, "UserListWindow"))); gtk_main(); }
int main(int argc, char *argv[]) { if (argc < 4) { g_critical(L_("Expecting 3 arguments.")); return 1; } else { GtkLabel *lbl; GladeXML *glade_xml; GError *err = NULL; GConfClient *gconf; gboolean keep_password; gchar *password; const gchar *gconf_keep_password; const gchar *gconf_password; gtk_init(&argc, &argv); gconf_password = g_getenv("PPP_GCONF_PASSWORD"); gconf_keep_password = g_getenv("PPP_GCONF_KEEP_PASSWORD"); if (!gconf_password || !gconf_keep_password) { g_critical(L_("Environment variables not set.")); exit(1); } if (argv[3] != NULL) { output_file_descriptor = atoi(argv[3]); } gconf = gconf_client_get_default(); keep_password = gconf_client_get_bool(gconf, gconf_keep_password, &err); /* user has password in database, spit it out */ if (!err && keep_password) { password = gconf_client_get_string(gconf, gconf_password, &err); if (!err && password) { int len = strlen(password); if (write(output_file_descriptor, password, len) != len) { g_warning(L_("could not write to file descriptor\n")); } /* all went fine, say bye */ return 0; } } glade_init(); glade_xml = glade_xml_new(BR_DATADIR("/gnome-ppx/ppp_get_password.glade"), NULL, NULL); glade_xml_signal_autoconnect(glade_xml); password_entry = GTK_ENTRY(glade_xml_get_widget (glade_xml, "gtk_entry_password")); lbl = GTK_LABEL(glade_xml_get_widget (glade_xml, "msg_label")); g_object_unref(glade_xml); username = argv[1]; server = argv[2]; change_gtk_label(lbl); gtk_main(); } return ret; }
/////////////////////////////////////////////////////////////////////////////////////////// // // CS : PRIVATE gint initApplication(gint argc, gchar *argv[], gchar *pPrinterName) // IN : gint argc : Number of arguments. // gchar *argv[] : Arguments. // gchar *pPrinterName : Printer name. // OUT : None. // RETURN : ID_ERR_NO_ERROR : No error. // other : Error occured. // PRIVATE gint initApplication(gint argc, gchar *argv[], gchar *pPrinterName) { /*** Parameters start ***/ ST_ErrorCodeTbl errorInfo; // Error info. gchar productName[MAX_BUF_SIZE]; // Product name. gchar windowTitle[MAX_BUF_SIZE]; // Window title. gchar statusStr[MAX_BUF_SIZE]; // Buffer for printer status message. gboolean printerReady = FALSE; // Flag for printer is ready or not. gboolean jobExist = FALSE; // Flag for active job exist or not. gint i = 0, j = 0; // Counter. gint retVal = ID_ERR_NO_ERROR; // Return value. static gchar small_modelname[MAX_BUF_SIZE];// smallmodel name. //gchar small_modelname[MAX_BUF_SIZE];// smallmodel name. gchar manufacture[MAX_BUF_SIZE]; // manufacture name. gchar tmp_modelname[MAX_BUF_SIZE];// tmp name. gchar module_name[MAX_BUF_SIZE]; // module name. // gint cnt = 0; // Counter. gint mismatch_flag = 0; // Mismatch Flag. //Ver.3.10 for Network int pipe_fds[2]; gchar deviceURI[MAX_BUF_SIZE]; /* DeviceURI name. */ gchar backend_name_net[] = "cnijnet:/"; /* Net Backend Name */ gchar backend_name_usb[] = "cnijusb:/"; /* USB Backend Name */ gchar macaddress[128]; /* macaddress */ gint backend_Is = -1; gchar modelIDstr[5]; /*** Parameters end ***/ // Initialize buffer. memset(gDestName, 0, sizeof(gDestName)); memset(productName, 0, sizeof(productName)); memset(windowTitle, 0, sizeof(windowTitle)); memset(statusStr, 0, sizeof(statusStr)); memset(small_modelname, 0, sizeof(small_modelname)); memset(tmp_modelname, 0, sizeof(small_modelname)); memset(manufacture, 0, sizeof(manufacture)); memset(module_name, 0, sizeof(module_name)); memset(deviceURI, 0, sizeof(deviceURI)); memset(macaddress, 0x00, sizeof(macaddress)) ; memset(modelIDstr, 0, sizeof(modelIDstr)); // strcpy(windowTitle, STR_MANUFACTURER_NAME); delete V2.3 // strcat(windowTitle, " "); delete V2.3 // signal( SIGTERM, cnijnpr_sigterm_handler ); signal( SIGCHLD, cnijnpr_sigchild_handler ); // Initialize printer status area. initPrinterStatus(&gPrinterStatus); if (pPrinterName == NULL) { // Printer name is not input. Get default printer name. retVal = getDefaultPrinterName(gDestName, sizeof(gDestName)); if (retVal != ID_ERR_NO_ERROR) { memset(&errorInfo, 0, sizeof(ST_ErrorCodeTbl)); getErrorCodeInfo(retVal, &errorInfo); if (errorInfo.errorLevel != ID_ERR_LEVEL_FATAL) { retVal = ID_ERR_NO_ERROR; } } } else { strncpy(gDestName, pPrinterName, sizeof(gDestName)); } /* Ver.3.20 for small_modelname */ retVal = getProductName(gDestName, productName, modelIDstr); //retVal = getProductName(gDestName, productName); if (retVal == ID_ERR_NO_ERROR) { // check cngpijmonip4300 and ppd productName strncat(manufacture, STR_MANUFACTURER_NAME, strlen(STR_MANUFACTURER_NAME) ); for( i=0,j=0; i<(sizeof(productName) - 1) ; i++){ if(manufacture[i] != productName[i]){ tmp_modelname[j] = tolower(productName[i+1]); j++; } tmp_modelname[j] = '\0'; } for( i=0,j=0; i<(sizeof(tmp_modelname) - 1) ; i++){ if(tmp_modelname[i] == ' ') break; else{ small_modelname[j] = tmp_modelname[i]; j++; } small_modelname[j] = '\0'; } } /* Ver.3.20 for small_modelname */ /* for Network Ver.3.10 */ retVal = getDeviceURI( gDestName, deviceURI, sizeof(deviceURI) ); if (retVal != ID_ERR_NO_ERROR){ exit(0) ; } /* get Mac Address */ /* When cnij_net is Backend */ if (strncmp(deviceURI, backend_name_net, strlen(backend_name_net)) != 0){ /* When cnij_usb is Backend */ //20090202 backend: IPP:ipp://198.168.1.23... cnijusb backend_Is = CANON_USB_BACKEND_CNIJ_USB; pPrinterName = NULL; //20090202 backend: IPP:ipp://198.168.1.23... cnijusb if (strncmp(deviceURI, backend_name_usb, strlen(backend_name_usb)) == 0){ strncpy(macaddress, deviceURI + strlen(backend_name_usb), (strlen(deviceURI)-strlen(backend_name_usb)) ); backend_Is = CANON_USB_BACKEND_CNIJ_USB; pPrinterName = NULL; } } else { strncpy(macaddress, deviceURI + strlen(backend_name_net), (strlen(deviceURI)-strlen(backend_name_net)) ); backend_Is = CANON_BJNP_BACKEND_CNIJ_NET; } /* for Network Ver.3.00 */ /* pipe create */ if( backend_Is == CANON_BJNP_BACKEND_CNIJ_NET ){ /* pipe create */ if( pipe(pipe_fds) < 0 ) return( -1 ); g_pid = fork(); } else{ g_pid = -2; //g_pid = 1; } if( g_pid == -1 ){ return( -1 ) ; } /* child process */ else if( g_pid == 0 ){ static char str_msg[128]; /* message buffer */ char argv_pipe[128]; /* new pipe */ char argv_uri[128]; /* argv URI */ char hostname[256]; /* hostname */ char username[256]; /* username(loginnamae) */ int rtn = 0; struct passwd usrpasswd; struct passwd *lpusrpasswd = NULL; static int cmd_argv_cnt = 0 ; /* argument counter */ static char *cmd_argv[16] ; /* command argument beffer */ lpusrpasswd = &usrpasswd; memset( str_msg, 0x00, sizeof(str_msg) ) ; memset( argv_pipe, 0x00, sizeof(argv_pipe) ) ; memset( argv_uri, 0x00, sizeof(argv_uri) ) ; memset( username, 0x00, sizeof(username) ) ; //printf("Child --%d\n", getpid()); sprintf( argv_pipe, "%d", pipe_fds[1] ); //close( 0 ); //dup2( pipe_fds[0], 0 ); close( pipe_fds[0] ); sprintf( argv_uri, "%s", macaddress ); if (gethostname(hostname, sizeof(hostname)-1) != 0) exit(0); //if( getlogin() == NULL ) exit(0); lpusrpasswd = getpwuid(getuid()); if( lpusrpasswd == NULL ) exit(0); if( lpusrpasswd->pw_name == NULL ) exit(0); strncpy(username, lpusrpasswd->pw_name, sizeof(username)-1); //strncpy(username, getlogin(), sizeof(username)-1); cmd_argv[cmd_argv_cnt++] = "cnijnpr"; cmd_argv[cmd_argv_cnt++] = argv_pipe; cmd_argv[cmd_argv_cnt++] = argv_uri; cmd_argv[cmd_argv_cnt++] = hostname; cmd_argv[cmd_argv_cnt++] = username; /* Ver.3.20 for bscc2sts */ cmd_argv[cmd_argv_cnt++] = small_modelname; cmd_argv[cmd_argv_cnt++] = modelIDstr; cmd_argv[cmd_argv_cnt++] = NULL; rtn = execvp ( CNIJNPR_CMD_BASE_STR, cmd_argv ); //rtn = execlp("cnijnpr", "cnijnpr", argv_pipe, argv_uri, hostname, username, NULL); if( rtn < 0 ){ exit(0) ; } close( pipe_fds[1] ); } /* parents process */ else { //for bscc output_dev __attribute__ ((unused)) Odev; char buf[4096]; memset( buf, 0x00, sizeof(buf) ) ; Odev.status = 0; Odev.dev = 0;//device_type; if( backend_Is == CANON_BJNP_BACKEND_CNIJ_NET ){ //printf("parents process : --%d\n", getpid()); close( 0 ); dup2( pipe_fds[0], 0 ); close( pipe_fds[0] ); close( pipe_fds[1] ); } // Initialize printer status area. initPrinterStatus(&gPrinterStatus); /* for Network Ver.3.10 */ if (retVal == ID_ERR_NO_ERROR) { // Init GTK, Glade, etc. bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR); /* for GTK 2.X */ bind_textdomain_codeset (PACKAGE, "UTF-8"); textdomain(PACKAGE); #ifndef USE_libglade SetGtkResourceDefault(); #endif gtk_set_locale(); gtk_init(&argc, &argv); #ifdef USE_libglade glade_init(); #endif // USE_libglade // Get printer product name. (for create window title string) retVal = getProductName(gDestName, productName, modelIDstr); //retVal = getProductName(gDestName, productName); if (retVal == ID_ERR_NO_ERROR) { /* Ver.3.20 move up */ // // check cngpijmonip4300 and ppd productName // strncat(manufacture, STR_MANUFACTURER_NAME, strlen(STR_MANUFACTURER_NAME) ); // for( i=0,j=0; i<(sizeof(productName) - 1) ; i++){ // if(manufacture[i] != productName[i]){ // tmp_modelname[j] = tolower(productName[i+1]); // j++; // } // tmp_modelname[j] = '\0'; // } // // for( i=0,j=0; i<(sizeof(tmp_modelname) - 1) ; i++){ // if(tmp_modelname[i] == ' ') // break; // else{ // small_modelname[j] = tmp_modelname[i]; // j++; // } // small_modelname[j] = '\0'; // } snprintf(module_name, sizeof(module_name), "%s%s",STR_APPLICATION_NAME, small_modelname); for( i=0; i<strlen(module_name) ; i++){ if( module_name[i] != *(argv[0]+i) ){ memset(productName, 0, sizeof(productName)); snprintf(productName, sizeof(productName), "%s%s", STR_MANUFACTURER_NAME, ""); mismatch_flag = 1; } } // check cngpijmonip4300 and ppd productName /* for Network Ver.3.10 */ if( (backend_Is == CANON_BJNP_BACKEND_CNIJ_NET) && (mismatch_flag != 1) ){ strncpy(windowTitle, productName, sizeof(windowTitle)-strlen(macaddress)-1 ); strncat(windowTitle, " ", strlen(" ")); strncat(windowTitle, macaddress, strlen(macaddress)); } else if( (backend_Is == CANON_USB_BACKEND_CNIJ_USB) && (mismatch_flag != 1) ){ strncpy(windowTitle, productName, sizeof(windowTitle)-strlen(STR_USB_NAME)-1 ); strncat(windowTitle, " ", strlen(" ")); strncat(windowTitle, STR_USB_NAME, strlen(STR_USB_NAME)); } /* Canon iPxxx series Status Monitor */ /* when mismatch_flag == 1 */ else { strncpy(windowTitle, productName, sizeof(windowTitle)-strlen(STR_PRODUCT_NAME)-1 ); // V2.3 strcat->strcpy strncat(windowTitle, " ", strlen(" ")); strncat(windowTitle, STR_PRODUCT_NAME, strlen(STR_PRODUCT_NAME)); } // Check printer and job. retVal = checkPrinterAndJobState(gDestName, &printerReady, &jobExist); if (retVal == ID_ERR_NO_ERROR) { if ( (printerReady == FALSE) || (mismatch_flag == 1) ) { //if (printerReady == FALSE) { // Printer is not registerd in CUPS. retVal = ID_ERR_UNKNOWN_PRINTER; } else { // Printer is registerd in CUPS. if ( (jobExist == FALSE) && (backend_Is == CANON_USB_BACKEND_CNIJ_USB) ) { // Print job not exist. retVal = ID_ERR_PRINT_JOB_NOT_EXIST; } else { // Print job exist. Get printer status string. getPrinterStatus(gDestName, statusStr, sizeof(statusStr)); retVal = getPrinterStatus(gDestName, statusStr, sizeof(statusStr)); retVal = ID_ERR_PRINT_JOB_NOT_EXIST; if (retVal == ID_ERR_NO_ERROR) { // Check status string. if (strncmp(statusStr, STR_HEADER_STATUS_STRING, strlen(STR_HEADER_STATUS_STRING)) == 0) { // Get printer status information. retVal = translatePrinterStatus(statusStr, &gPrinterStatus); } if (retVal == ID_ERR_NO_ERROR) { // Init UI. initUI(windowTitle, &gPrinterStatus, TRUE, -1); // Set calling timeout function. //for Network Ver.3.10 gTimeoutFuncTag = gtk_timeout_add(TIMEOUT_CALL_UPDATE_UI_FUNC, (GtkFunction)updateUI, small_modelname); //gTimeoutFuncTag = gtk_timeout_add(TIMEOUT_CALL_UPDATE_UI_FUNC, (GtkFunction)updateUI, NULL); } } } } } } else { strncpy(windowTitle, STR_MANUFACTURER_NAME, sizeof(windowTitle)-strlen(STR_PRODUCT_NAME)-1 ); // V2.3 add strncat(windowTitle, " ", strlen(" ")); // V2.3 add strncat(windowTitle, STR_PRODUCT_NAME, strlen(STR_PRODUCT_NAME)); } } if (retVal != ID_ERR_NO_ERROR) { // Check error. memset(&errorInfo, 0, sizeof(ST_ErrorCodeTbl)); getErrorCodeInfo(retVal, &errorInfo); if (errorInfo.errorLevel != ID_ERR_LEVEL_FATAL) { // Process continuing is possible. Init UI. initUI(windowTitle, NULL, FALSE, errorInfo.messageID); if (retVal != ID_ERR_UNKNOWN_PRINTER) { // Set calling timeout function. //for Network Ver.3.10 if(backend_Is == CANON_USB_BACKEND_CNIJ_USB) memset(small_modelname, 0, sizeof(small_modelname)); gTimeoutFuncTag = gtk_timeout_add(TIMEOUT_CALL_UPDATE_UI_FUNC, (GtkFunction)updateUI, small_modelname); //gTimeoutFuncTag = gtk_timeout_add(TIMEOUT_CALL_UPDATE_UI_FUNC, (GtkFunction)updateUI, NULL); } retVal = ID_ERR_NO_ERROR; } } }/* parents process end */ return(retVal); }// End initApplication
int main(int argc, char *argv[]) { GtkWidget *window, *ok_but, *fix_but, *diag, *list, *scroll; GtkAdjustment *adj; product_component_t *component; product_option_t *option; product_file_t *file; int removed = 0, modified = 0; goto_installpath(argv[0]); /* Set the locale */ init_locale(); if ( argc < 2 ) { fprintf(stderr, _("Usage: %s product\n"), argv[0]); return 1; } gtk_init(&argc,&argv); argv0 = argv[0]; /* Initialize Glade */ glade_init(); check_glade = glade_xml_new("check.glade", "check_dialog"); /* Add all signal handlers defined in glade file */ glade_xml_signal_autoconnect(check_glade); window = glade_xml_get_widget(check_glade, "check_dialog"); gtk_widget_realize(window); while( gtk_events_pending() ) { gtk_main_iteration(); } diag = glade_xml_get_widget(check_glade, "diagnostic_label"); ok_but = glade_xml_get_widget(check_glade, "dismiss_button"); fix_but = glade_xml_get_widget(check_glade, "rescue_button"); list = glade_xml_get_widget(check_glade, "main_list"); scroll = glade_xml_get_widget(check_glade, "scrolledwindow"); product = loki_openproduct(argv[1]); if ( ! product ) { message_dialog(_("Impossible to locate the product information.\nMaybe another user installed it?"), _("Error")); return 1; } info = loki_getinfo_product(product); gtk_label_set_text(GTK_LABEL(diag), ""); gtk_widget_set_sensitive(fix_but, FALSE); adj = GTK_ADJUSTMENT(gtk_adjustment_new(100.0, 1.0, 100.0, 1.0, 10.0, 10.0)); gtk_scrolled_window_set_vadjustment(GTK_SCROLLED_WINDOW(scroll), adj); /* Iterate through the components */ for ( component = loki_getfirst_component(product); component; component = loki_getnext_component(component) ) { add_message(list, _("---> Checking component '%s'..."), loki_getname_component(component)); for ( option = loki_getfirst_option(component); option; option = loki_getnext_option(option) ) { add_message(list, _("-> Checking option '%s'..."), loki_getname_option(option)); for ( file = loki_getfirst_file(option); file; file = loki_getnext_file(file) ) { gtk_main_iteration(); switch ( loki_check_file(file) ) { case LOKI_REMOVED: add_message(list, _("%s was REMOVED"), loki_getpath_file(file)); removed ++; add_corrupt_file(product, loki_getpath_file(file), loki_getname_option(option)); break; case LOKI_CHANGED: add_message(list, _("%s was MODIFIED"), loki_getpath_file(file)); modified ++; add_corrupt_file(product, loki_getpath_file(file), loki_getname_option(option)); break; case LOKI_OK: add_message(list, _("%s is OK"), loki_getpath_file(file)); break; } } } } if ( removed || modified ) { char status[200]; snprintf(status, sizeof(status), _("Changes detected: %d files removed, %d files modified."), removed, modified); gtk_label_set_text(GTK_LABEL(diag), status); gtk_widget_set_sensitive(fix_but, TRUE); } else { gtk_label_set_text(GTK_LABEL(diag), _("No problems were found.")); } /* Run the UI.. */ gtk_main(); return 0; }
int main(int ac, char *av[]) { const char *name; char *env; gchar *glade_file; #ifndef LKC_DIRECT_LINK kconfig_load(); #endif bindtextdomain(PACKAGE, LOCALEDIR); bind_textdomain_codeset(PACKAGE, "UTF-8"); textdomain(PACKAGE); /* GTK stuffs */ gtk_set_locale(); gtk_init(&ac, &av); glade_init(); //add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps"); //add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps"); /* Determine GUI path */ env = getenv(SRCTREE); if (env) glade_file = g_strconcat(env, "/scripts/kconfig/gconf.glade", NULL); else if (av[0][0] == '/') glade_file = g_strconcat(av[0], ".glade", NULL); else glade_file = g_strconcat(g_get_current_dir(), "/", av[0], ".glade", NULL); /* Load the interface and connect signals */ init_main_window(glade_file); init_tree_model(); init_left_tree(); init_right_tree(); /* Conf stuffs */ if (ac > 1 && av[1][0] == '-') { switch (av[1][1]) { case 'a': //showAll = 1; break; case 'h': case '?': printf("%s <config>\n", av[0]); exit(0); } name = av[2]; } else name = av[1]; conf_parse(name); fixup_rootmenu(&rootmenu); conf_read(NULL); switch (view_mode) { case SINGLE_VIEW: display_tree_part(); break; case SPLIT_VIEW: display_list(); break; case FULL_VIEW: display_tree(&rootmenu); break; } gtk_main(); return 0; }
int main (int argc, char **argv) { #ifdef G_OS_WIN32 extern void link_shutdown (void); #endif GConfClient *client; #if DEVELOPMENT gboolean skip_warning_dialog; #endif GnomeProgram *program; GnomeClient *master_client; GOptionContext *context; char *filename; /* Make ElectricFence work. */ free (malloc (10)); bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); context = g_option_context_new (_("- The Evolution PIM and Email Client")); g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); g_option_context_set_translation_domain(context, GETTEXT_PACKAGE); #ifdef G_OS_WIN32 set_paths (); #endif program = gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, argc, argv, GNOME_PROGRAM_STANDARD_PROPERTIES, GNOME_PARAM_GOPTION_CONTEXT, context, GNOME_PARAM_HUMAN_READABLE_NAME, _("Evolution"), NULL); #ifdef G_OS_WIN32 if (strcmp (_(""), "") == 0) { /* No message catalog installed for the current locale language, * so don't bother with the localisations provided by other things then * either. Reset thread locale to "en-US" and C library locale to "C". */ SetThreadLocale (MAKELCID (MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); setlocale (LC_ALL, "C"); } #endif if (start_online && start_offline) { fprintf (stderr, _("%s: --online and --offline cannot be used together.\n Use %s --help for more information.\n"), argv[0], argv[0]); exit (1); } if (killev) { filename = g_build_filename (EVOLUTION_TOOLSDIR, "killev", NULL); execl (filename, "killev", NULL); /* Not reached */ exit (0); } client = gconf_client_get_default (); #if DEVELOPMENT if (force_migrate) { destroy_config (client); } #endif if (disable_preview) { gconf_client_set_bool (client, "/apps/evolution/mail/display/show_preview", FALSE, NULL); gconf_client_set_bool (client, "/apps/evolution/mail/display/safe_list", TRUE, NULL); gconf_client_set_bool (client, "/apps/evolution/addressbook/display/show_preview", FALSE, NULL); gconf_client_set_bool (client, "/apps/evolution/calendar/display/show_task_preview", FALSE, NULL); } setup_segv_redirect (); if (evolution_debug_log) { int fd; fd = g_open (evolution_debug_log, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd != -1) { dup2 (fd, STDOUT_FILENO); dup2 (fd, STDERR_FILENO); close (fd); } else g_warning ("Could not set up debugging output file."); } master_client = gnome_master_client (); g_signal_connect (G_OBJECT (master_client), "save_yourself", G_CALLBACK (gnome_master_client_save_yourself_cb), NULL); g_signal_connect (G_OBJECT (master_client), "die", G_CALLBACK (gnome_master_client_die_cb), NULL); glade_init (); e_cursors_init (); e_icon_factory_init (); e_passwords_init(); gtk_window_set_default_icon_name ("evolution"); if (setup_only) exit (0); gnome_sound_init ("localhost"); if (!disable_eplugin) { e_plugin_register_type(e_plugin_lib_get_type()); e_plugin_hook_register_type(es_menu_hook_get_type()); e_plugin_hook_register_type(es_event_hook_get_type()); #ifdef ENABLE_PROFILING e_plugin_hook_register_type(e_profile_event_hook_get_type()); #endif e_plugin_hook_register_type(e_plugin_type_hook_get_type()); e_plugin_hook_register_type(e_import_hook_get_type()); e_plugin_hook_register_type(E_TYPE_PLUGIN_UI_HOOK); e_plugin_load_plugins(); } #if DEVELOPMENT skip_warning_dialog = gconf_client_get_bool ( client, SKIP_WARNING_DIALOG_KEY, NULL); if (!skip_warning_dialog && !getenv ("EVOLVE_ME_HARDER")) gconf_client_set_bool ( client, SKIP_WARNING_DIALOG_KEY, show_development_warning (), NULL); else g_idle_add ((GSourceFunc) idle_cb, remaining_args); #else g_idle_add ((GSourceFunc) idle_cb, remaining_args); #endif g_object_unref (client); bonobo_main (); e_icon_factory_shutdown (); g_object_unref (program); gnome_sound_shutdown (); e_cursors_shutdown (); #ifdef G_OS_WIN32 link_shutdown (); #endif return 0; }
int main(int argc, char *argv[]) { int ret = 1; g_main_window=NULL; /* for UpdateMenuLink (check "first call") */ g_quality_dialog = NULL; /* for UpdateMenuLink (check "first call") */ bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR); bind_textdomain_codeset( PACKAGE, "UTF-8" ); textdomain(PACKAGE); gtk_set_locale(); // Set gtk resource file. SetGtkResourceFile(); gtk_init(&argc, &argv); #ifdef USE_LIB_GLADE // Initialize the glade library. glade_init(); #endif // Parse options. InitOption(argc, argv); // Set the directory name for storing keytext files. SetKeyTextDir(PACKAGE_DATA_DIR); #ifndef USE_LIB_GLADE // Set the directory name for storing xpm files. SetPixmapDir(PACKAGE_DATA_DIR); #endif // Load fontset. //g_main_font = LoadFontSet(); g_main_font = NULL; // Initialize signal control level. InitSignal(); // Load the glade and keytext file. if( LoadResources() ) { // Initialize databases. InitDataBase(g_model_name); // Initialize printint type table. InitPrintingType(); // Create main dialog, and realize it. g_main_window = CreateMainWindow(); gtk_widget_realize(UI_DIALOG(g_main_window)->window); // Create dialogs. CreateDialogs(); // Connect signal handlers. ConnectSignalHandlers(); // Update widgets. DisableSignal(); UpdateWidgets(UI_DIALOG(g_main_window)->window, NULL); EnableSignal(); // Set window title. snprintf(g_window_title, sizeof(g_window_title), "Canon %s", GetDispModelName()); //Ver.2.90(s) gtk_window_set_title( GTK_WINDOW(UI_DIALOG(g_main_window)->window), g_window_title); // Show widgets depend on model. ShowModelDependWidgets(g_main_window); gtk_widget_show(UI_DIALOG(g_main_window)->window); gtk_main(); ret = 0; // Dispose dialogs. DisposeDialogs(); // Dispose main dialog. DisposeDialog(UI_DIALOG(g_main_window)); // Free databases. FreeDataBase(); // Free resources. FreeResources(); } // Free Gdk resource. if( g_main_font ) gdk_font_unref(g_main_font); // Free option strings. FreeOption(); return ret; }
/*! \brief main() is the typical main function in a C program, it performs all core initialization, loading of all main parameters, initializing handlers and entering gtk_main to process events until program close \param argc is the count of command line arguments \param argv is the array of command line args \returns TRUE */ gint main(gint argc, gchar ** argv) { Serial_Params *serial_params = NULL; GAsyncQueue *queue = NULL; GCond *cond = NULL; GMutex *mutex = NULL; gint id = 0; setlocale(LC_ALL,""); #ifdef __WIN32__ bindtextdomain(PACKAGE, "C:\\Program Files\\MegaTunix\\dist\\locale"); #else bindtextdomain(PACKAGE, LOCALEDIR); #endif textdomain (PACKAGE); #ifdef DEBUG printf("This is a debug release, Git hash: %s\n",MTX_GIT_HASH); #endif if(!g_thread_supported()) g_thread_init(NULL); gdk_threads_init(); gtk_init(&argc, &argv); glade_init(); gdk_gl_init_check(&argc, &argv); gl_ability = gtk_gl_init_check(&argc, &argv); global_data = g_new0(gconstpointer, 1); /* Condition variables */ cond = g_cond_new(); DATA_SET(global_data,"statuscounts_cond",cond); cond = g_cond_new(); DATA_SET(global_data,"io_dispatch_cond",cond); cond = g_cond_new(); DATA_SET(global_data,"gui_dispatch_cond",cond); cond = g_cond_new(); DATA_SET(global_data,"pf_dispatch_cond",cond); cond = g_cond_new(); DATA_SET(global_data,"rtv_thread_cond",cond); /* Mutexes */ mutex = g_mutex_new(); DATA_SET(global_data,"serio_mutex",mutex); mutex = g_mutex_new(); DATA_SET(global_data,"rtt_mutex",mutex); mutex = g_mutex_new(); DATA_SET(global_data,"rtv_mutex",mutex); mutex = g_mutex_new(); DATA_SET(global_data,"dash_mutex",mutex); mutex = g_mutex_new(); DATA_SET(global_data,"statuscounts_mutex",mutex); mutex = g_mutex_new(); DATA_SET(global_data,"io_dispatch_mutex",mutex); mutex = g_mutex_new(); DATA_SET(global_data,"gui_dispatch_mutex",mutex); mutex = g_mutex_new(); DATA_SET(global_data,"pf_dispatch_mutex",mutex); mutex = g_mutex_new(); DATA_SET(global_data,"rtv_thread_mutex",mutex); /* For testing if gettext works printf(_("Hello World!\n")); */ /* Build table of strings to enum values */ build_string_2_enum_table(); serial_params = (Serial_Params *)g_malloc0(sizeof(Serial_Params)); DATA_SET(global_data,"serial_params",serial_params); handle_args(argc,argv); /* handle CLI arguments */ /* This will exit mtx if the locking fails! */ create_mtx_lock(); open_debug(); /* Open debug log */ /* Allocate memory */ init(); /* Initialize global vars */ make_mtx_dirs(); /* Create config file dirs if missing */ /* Create Message passing queues */ queue = g_async_queue_new(); DATA_SET_FULL(global_data,"io_data_queue",queue,g_async_queue_unref); queue = g_async_queue_new(); DATA_SET_FULL(global_data,"slave_msg_queue",queue,g_async_queue_unref); queue = g_async_queue_new(); DATA_SET_FULL(global_data,"pf_dispatch_queue",queue,g_async_queue_unref); queue = g_async_queue_new(); DATA_SET_FULL(global_data,"gui_dispatch_queue",queue,g_async_queue_unref); queue = g_async_queue_new(); DATA_SET_FULL(global_data,"io_repair_queue",queue,g_async_queue_unref); read_config(); setup_gui(); gtk_rc_parse_string("style \"override\"\n{\n\tGtkTreeView::horizontal-separator = 0\n\tGtkTreeView::vertical-separator = 0\n}\nwidget_class \"*\" style \"override\""); id = g_timeout_add_full(-50,16,(GSourceFunc)pf_dispatcher,NULL,NULL); DATA_SET(global_data,"pf_dispatcher_id",GINT_TO_POINTER(id)); id = g_timeout_add_full(-35,35,(GSourceFunc)gui_dispatcher,NULL,NULL); DATA_SET(global_data,"gui_dispatcher_id",GINT_TO_POINTER(id)); id = g_timeout_add(1000,(GSourceFunc)flush_binary_logs,NULL); DATA_SET(global_data,"binlog_flush_id",GINT_TO_POINTER(id)); sleep_calib(); /* Check for first_time flag, if so, run first tiem wizard, otherwise load personality choice */ gdk_threads_add_timeout(500,(GSourceFunc)check_for_first_time,NULL); DATA_SET(global_data,"ready",GINT_TO_POINTER(TRUE)); gdk_threads_enter(); gtk_main(); gdk_threads_leave(); return (0) ; }