Exemplo n.º 1
0
Arquivo: main.c Projeto: wavs/ocre
/*
** the main function
*/
int main (int argc, char *argv[])
{
  GUI_* gui;

  gtk_init (&argc, &argv);

  gui = g_slice_new(GUI_);

  gui->gxml   = glade_xml_new ("../gui/gui.glade", NULL, NULL);
  gui->window = glade_xml_get_widget (gui->gxml, "window");
  gui->image  = glade_xml_get_widget (gui->gxml, "image");
  gui->textview = glade_xml_get_widget (gui->gxml, "textview");

  glade_xml_signal_connect (gui->gxml, "on_window_destroy",
			    G_CALLBACK (gtk_main_quit));
  glade_xml_signal_connect_data (gui->gxml, "on_open_show",
				 G_CALLBACK (on_open_show),
				 gui);
  glade_xml_signal_connect_data (gui->gxml, "on_save_show",
				 G_CALLBACK (on_save_show),
				 gui);
  glade_xml_signal_connect_data (gui->gxml, "on_text_show",
				 G_CALLBACK (preprocess),
				 gui);
  glade_xml_signal_connect_data (gui->gxml, "on_block",
				 G_CALLBACK (detect_blocks),
				 gui);
  glade_xml_signal_connect (gui->gxml, "on_about_show",
			    G_CALLBACK (on_about_show));

  gtk_widget_show (gui->window);
  gtk_main ();

  return 0;
}
Exemplo n.º 2
0
static int
setup_interface( void )
{
  GtkWidget *window, *treeview, *select_entry, *spawn_dialog, *spawn_label;
  GtkCellRenderer *renderer;

  gtk_window_set_default_icon_name( "gnome-dev-keyboard" );

  wl = window_list_new();

  xml = glade_xml_new( PREFIX "/share/keyboardcast/keyboardcast.glade",
                       NULL, NULL );

  if( xml == NULL )
    return 1;

  select_entry = glade_xml_get_widget( xml, "select-entry" );
  treeview = glade_xml_get_widget( xml, "treeview" );
  window = glade_xml_get_widget( xml, "window" );
  spawn_dialog = glade_xml_get_widget( xml, "spawn-dialog" );
  spawn_label = glade_xml_get_widget( xml, "spawn-label" );

  if( select_entry == NULL || treeview == NULL ||
      window == NULL || spawn_dialog == NULL || spawn_label == NULL )
    return 1;

  gtk_tree_view_set_model( GTK_TREE_VIEW( treeview ), GTK_TREE_MODEL( wl ) );

  renderer = window_list_toggle_renderer( wl );
  gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( treeview ), -1,
                                               "✓", renderer, // ☑☒✓✔
                                               "active", 1, NULL );

  renderer = gtk_cell_renderer_text_new();
  gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( treeview ), -1,
                                               "Window Title", renderer,
                                               "text", 2, NULL );

  glade_xml_signal_connect( xml, "key_event", G_CALLBACK( key_event ) );
  glade_xml_signal_connect( xml, "gtk_exit", G_CALLBACK( gtk_exit ) );
  glade_xml_signal_connect_data( xml, "expanded",
                                 G_CALLBACK( expanded ), window );
  glade_xml_signal_connect_data( xml, "button_clicked",
                                 G_CALLBACK( button_clicked ), select_entry );
  glade_xml_signal_connect_data( xml, "spawn_clicked",
                                 G_CALLBACK( spawn_clicked ), spawn_dialog );
  glade_xml_signal_connect( xml, "terminal_toggled",
                            G_CALLBACK( terminal_toggled ) );
  glade_xml_signal_connect_data( xml, "update_label",
                                 G_CALLBACK( update_label ), spawn_label );

  update_label( NULL, GTK_LABEL( spawn_label ) );

  window_list_filter_by_process( wl, "gnome-terminal" );

  gtk_widget_show_all( window );

  return 0;
}
Exemplo n.º 3
0
void explorer_init_history(Explorer *self)
{
    GtkWidget *menu = glade_xml_get_widget(self->xml, "go_menu_menu");

    self->history_queue = g_queue_new();

    /* Connect signal handlers
     */
    glade_xml_signal_connect_data(self->xml, "on_go_back",     G_CALLBACK(on_go_back),        self);
    glade_xml_signal_connect_data(self->xml, "on_go_forward",  G_CALLBACK(on_go_forward),     self);
    g_signal_connect             (self->map, "notify",         G_CALLBACK(on_change_notify),  self);
    g_signal_connect             (menu,      "show",           G_CALLBACK(on_go_menu_show),   self);
    g_signal_connect             (menu,      "hide",           G_CALLBACK(on_go_menu_hide),   self);
}
Exemplo n.º 4
0
static void animation_render_ui_init(AnimationRenderUi *self) {
    if (g_file_test (FYRE_DATADIR "/animation-render.glade", G_FILE_TEST_EXISTS))
        self->xml = glade_xml_new(FYRE_DATADIR "/animation-render.glade", NULL, NULL);
    if (!self->xml)
	self->xml = glade_xml_new(BR_DATADIR("/fyre/animation-render.glade"), NULL, NULL);

    fyre_set_icon_later(glade_xml_get_widget(self->xml, "window"));

    glade_xml_signal_connect_data(self->xml, "on_ok_clicked",                 G_CALLBACK(on_ok_clicked),                 self);
    glade_xml_signal_connect_data(self->xml, "on_cancel_clicked",             G_CALLBACK(on_cancel_clicked),             self);
    glade_xml_signal_connect_data(self->xml, "on_select_output_file_clicked", G_CALLBACK(on_select_output_file_clicked), self);
    glade_xml_signal_connect_data(self->xml, "on_delete_event",               G_CALLBACK(on_delete_event),               self);

    self->map = ITERATIVE_MAP(de_jong_new());
    self->frame.a = PARAMETER_HOLDER(de_jong_new());
    self->frame.b = PARAMETER_HOLDER(de_jong_new());
}
Exemplo n.º 5
0
EventLog *
event_log_create (GtkWindow *parent)
{
	EventLog  *log = g_new0 (EventLog, 1);
	
	log->xml = get_glade_xml();
	log->window = glade_xml_get_widget (log->xml, "event_window");

	gtk_window_set_transient_for (GTK_WINDOW (log->window), parent);
	glade_xml_signal_connect_data (log->xml, "events_clear_clicked",
				       G_CALLBACK (events_clear_clicked), log);
	glade_xml_signal_connect_data (log->xml, "events_select_all_clicked",
				       G_CALLBACK (events_select_all_clicked), log);
	glade_xml_signal_connect_data (log->xml, "events_save_as_clicked",
				       G_CALLBACK (events_save_as_clicked), log);

	log->text_view = GTK_TEXT_VIEW (glade_xml_get_widget (log->xml, "event_text_view"));
	log->filters_view = GTK_TREE_VIEW (glade_xml_get_widget (log->xml, "event_filters"));

	g_signal_connect (log->text_view, "button_press_event",
			  G_CALLBACK (link_clicked), log);

	log->log_text = gtk_text_buffer_new (NULL);
	gtk_text_view_set_buffer (log->text_view, log->log_text);
	gtk_text_view_set_wrap_mode (log->text_view, /* GTK_WRAP_NONE */ GTK_WRAP_CHAR);

	setup_filters (log);
	log->global_listener = SPI_createAccessibleEventListener (global_event_callback, log);
	log->idle_tail = 0;
#ifdef IDLE_LOGGING
	log->idle_log = 0;
	log->event_list = NULL;
#endif

	gtk_widget_show (log->window);

	return log;
}
Exemplo n.º 6
0
GtkWidget *
gnc_column_view_edit_options(SCM options, SCM view)
{
    SCM get_editor = scm_c_eval_string("gnc:report-editor-widget");
    SCM ptr;
    GtkWidget * editor;
    GtkListStore *store;
    GtkCellRenderer *renderer;
    GtkTreeViewColumn *column;
    GtkTreeSelection *selection;

    ptr = scm_call_1(get_editor, view);
    if (ptr != SCM_BOOL_F)
    {
#define FUNC_NAME "gtk_window_present"
        GtkWindow * w = SWIG_MustGetPtr(ptr, SWIG_TypeQuery("_p_GtkWidget"), 1, 0);
        gtk_window_present(w);
#undef FUNC_NAME
        return NULL;
    }
    else
    {
        gnc_column_view_edit * r = g_new0(gnc_column_view_edit, 1);
        GladeXML *xml;

        r->optwin = gnc_options_dialog_new(NULL);

        /* Hide the generic dialog page list. */
        {
            GtkWidget *dialog, *page_list;

            dialog = gnc_options_dialog_widget(r->optwin);
            page_list = gnc_glade_lookup_widget (dialog, "page_list");
            gtk_widget_hide(page_list);
        }

        xml = gnc_glade_xml_new ("report.glade", "view_contents_table");

        glade_xml_signal_connect_data
        (xml, "gnc_column_view_edit_add_cb",
         G_CALLBACK (gnc_column_view_edit_add_cb), r);

        glade_xml_signal_connect_data
        (xml, "gnc_column_view_edit_remove_cb",
         G_CALLBACK (gnc_column_view_edit_remove_cb), r);

        glade_xml_signal_connect_data
        (xml, "gnc_edit_column_view_move_up_cb",
         G_CALLBACK (gnc_edit_column_view_move_up_cb), r);

        glade_xml_signal_connect_data
        (xml, "gnc_edit_column_view_move_down_cb",
         G_CALLBACK (gnc_edit_column_view_move_down_cb), r);

        glade_xml_signal_connect_data
        (xml, "gnc_column_view_edit_size_cb",
         G_CALLBACK (gnc_column_view_edit_size_cb), r);

        editor       = glade_xml_get_widget (xml, "view_contents_table");
        r->available = GTK_TREE_VIEW (glade_xml_get_widget (xml, "available_view"));
        r->contents  = GTK_TREE_VIEW (glade_xml_get_widget (xml, "contents_view"));
        r->options   = options;
        r->view      = view;
        r->available_selected = 0;
        r->available_list = SCM_EOL;
        r->contents_selected = 0;
        r->contents_list = SCM_EOL;
        r->odb       = gnc_option_db_new(r->options);

        gnc_options_dialog_build_contents(r->optwin, r->odb);

        gtk_notebook_append_page(GTK_NOTEBOOK(gnc_options_dialog_notebook
                                              (r->optwin)),
                                 editor,
                                 gtk_label_new(_("Contents")));

        scm_gc_protect_object(r->options);
        scm_gc_protect_object(r->view);
        scm_gc_protect_object(r->available_list);
        scm_gc_protect_object(r->contents_list);

        /* Build the 'available' view */
        store = gtk_list_store_new (NUM_AVAILABLE_COLS, G_TYPE_STRING, G_TYPE_INT);
        gtk_tree_view_set_model(r->available, GTK_TREE_MODEL(store));
        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), AVAILABLE_COL_NAME, GTK_SORT_ASCENDING);
        g_object_unref(store);

        renderer = gtk_cell_renderer_text_new();
        column = gtk_tree_view_column_new_with_attributes("", renderer,
                 "text", AVAILABLE_COL_NAME,
                 NULL);
        gtk_tree_view_append_column(r->available, column);

        selection = gtk_tree_view_get_selection(r->available);
        g_signal_connect(selection, "changed",
                         G_CALLBACK(gnc_column_view_select_avail_cb), r);

        /* Build the 'contents' view */
        store = gtk_list_store_new (NUM_CONTENTS_COLS, G_TYPE_STRING, G_TYPE_INT,
                                    G_TYPE_INT, G_TYPE_INT);
        gtk_tree_view_set_model(r->contents, GTK_TREE_MODEL(store));
        g_object_unref(store);

        renderer = gtk_cell_renderer_text_new();
        column = gtk_tree_view_column_new_with_attributes(_("Report"), renderer,
                 "text", CONTENTS_COL_NAME,
                 NULL);
        gtk_tree_view_append_column(r->contents, column);

        renderer = gtk_cell_renderer_text_new();
        column = gtk_tree_view_column_new_with_attributes(_("Rows"), renderer,
                 "text", CONTENTS_COL_REPORT_ROWS,
                 NULL);
        gtk_tree_view_append_column(r->contents, column);

        renderer = gtk_cell_renderer_text_new();
        column = gtk_tree_view_column_new_with_attributes(_("Cols"), renderer,
                 "text", CONTENTS_COL_REPORT_COLS,
                 NULL);
        gtk_tree_view_append_column(r->contents, column);

        selection = gtk_tree_view_get_selection(r->contents);
        g_signal_connect(selection, "changed",
                         G_CALLBACK(gnc_column_view_select_contents_cb), r);

        update_display_lists(r);

        gnc_options_dialog_set_apply_cb(r->optwin,
                                        gnc_column_view_edit_apply_cb, r);
        gnc_options_dialog_set_close_cb(r->optwin,
                                        gnc_column_view_edit_close_cb, r);

        gtk_widget_show(gnc_options_dialog_widget(r->optwin));
        return gnc_options_dialog_widget(r->optwin);
    }
}
Exemplo n.º 7
0
static void explorer_init(Explorer *self) {

    if (g_file_test (FYRE_DATADIR "/explorer.glade", G_FILE_TEST_EXISTS))
        self->xml = glade_xml_new (FYRE_DATADIR "/explorer.glade", NULL, NULL);
    if (!self->xml)
	self->xml = glade_xml_new(BR_DATADIR("/fyre/explorer.glade"), NULL, NULL);
    if (!self->xml) {
	GtkWidget *dialog;
	dialog = gtk_message_dialog_new_with_markup(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
						    "<b>Fyre can't find its data files.</b>\n\n"
						    "The main glade file could not be located.\n"
						    "We tried looking for it in the following places:\n"
						    "\n"
						    "    %s\n"
						    "    %s",
						    FYRE_DATADIR "/explorer.glade",
						    BR_DATADIR("/fyre/explorer.glade"));
	gtk_dialog_run(GTK_DIALOG(dialog));
	exit(0);
    }

    self->window = glade_xml_get_widget(self->xml, "explorer_window");
    fyre_set_icon_later(self->window);
    fyre_set_icon_later(glade_xml_get_widget(self->xml, "animation_window"));
    fyre_set_icon_later(glade_xml_get_widget(self->xml, "interactive_prefs"));
    fyre_set_icon_later(glade_xml_get_widget(self->xml, "cluster_window"));
    fyre_set_icon_later(glade_xml_get_widget(self->xml, "about_window"));
    fyre_set_icon_later(glade_xml_get_widget(self->xml, "error dialog"));

    /* Connect signal handlers */
    glade_xml_signal_connect_data(self->xml, "on_randomize",                    G_CALLBACK(on_randomize),                    self);
    glade_xml_signal_connect_data(self->xml, "on_load_defaults",                G_CALLBACK(on_load_defaults),                self);
    glade_xml_signal_connect_data(self->xml, "on_save",                         G_CALLBACK(on_save),                         self);
    glade_xml_signal_connect_data(self->xml, "on_save_exr",                     G_CALLBACK(on_save_exr),                     self);
    glade_xml_signal_connect_data(self->xml, "on_quit",                         G_CALLBACK(on_quit),                         self);
    glade_xml_signal_connect_data(self->xml, "on_pause_rendering_toggle",       G_CALLBACK(on_pause_rendering_toggle),       self);
    glade_xml_signal_connect_data(self->xml, "on_load_from_image",              G_CALLBACK(on_load_from_image),              self);
    glade_xml_signal_connect_data(self->xml, "on_widget_toggle",                G_CALLBACK(on_widget_toggle),                self);
    glade_xml_signal_connect_data(self->xml, "on_zoom_reset",                   G_CALLBACK(on_zoom_reset),                   self);
    glade_xml_signal_connect_data(self->xml, "on_zoom_in",                      G_CALLBACK(on_zoom_in),                      self);
    glade_xml_signal_connect_data(self->xml, "on_zoom_out",                     G_CALLBACK(on_zoom_out),                     self);
    glade_xml_signal_connect_data(self->xml, "on_render_time_changed",          G_CALLBACK(on_render_time_changed),          self);
    glade_xml_signal_connect_data(self->xml, "on_interactive_prefs_delete",     G_CALLBACK(on_interactive_prefs_delete),     self);

#ifndef HAVE_EXR
    /* If we don't have OpenEXR support, gray out the menu item
     * so it sits there taunting the user and not breaking HIG
     */
    gtk_widget_set_sensitive(glade_xml_get_widget(self->xml, "save_image_as_exr"), FALSE);
#endif

    /* Set up the statusbar */
    self->statusbar = GTK_STATUSBAR(glade_xml_get_widget(self->xml, "statusbar"));
    self->render_status_context = gtk_statusbar_get_context_id(self->statusbar, "Rendering status");
    self->speed_timer = g_timer_new();
    self->auto_update_rate_timer = g_timer_new();
    self->status_update_rate_timer = g_timer_new();
}
Exemplo n.º 8
0
/**
 * \brief Create all the skel or container windows for modules but ui.
 *
 * ui, is only part of skel, all the content is filled later.
 *
 * content type:
 *      page, trigger, hbar, vbar
 *
 * main window.             p.ui.ui.window.main
 * optn window.             p.ui.ui.window.optn
 * info window.             p.ui.ui.window.info
 * media window             p.ui.ui.window.media
 */
static void ui_create_ui(KIM * im)
{
    char xmlpath[1024];
    sprintf(xmlpath, "%s\\ui\\main.glade", kim_getstr(im, "s.env.path.moduleDir", knil));
    kstr_subs(xmlpath, '\\', kvfs_path_sep());

    GladeXML *gxml = glade_xml_new(xmlpath, NULL, NULL);
    kim_addptr(im, "p.ui.ui.glade", (kvoid *) gxml, RF_AUTOSET, knil, knil);

    GtkWidget *window_main = glade_xml_get_widget(gxml, "window_main");
    kim_addptr(im, "p.ui.ui.window.main", (kvoid *) window_main, RF_AUTOSET, knil, knil);
    klog(("window_main: %s\n", GTK_OBJECT_TYPE_NAME(window_main)));

    GtkWidget *vbox_main = glade_xml_get_widget(gxml, "winmain_vbox_main");
    klog(("vbox_main: %s\n", GTK_OBJECT_TYPE_NAME(vbox_main)));

    gtk_drag_dest_set(vbox_main, GTK_DEST_DEFAULT_ALL, target_table, n_targets, /* no rootwin */
                      GdkDragAction(GDK_ACTION_COPY | GDK_ACTION_MOVE));
    g_signal_connect(vbox_main, "drag_drop", G_CALLBACK(target_drag_drop), vbox_main);

    g_signal_connect(vbox_main, "drag_data_received", G_CALLBACK(target_drag_data_received), NULL);


    if (0) {
        GtkWidget *button;
        button = gtk_button_new_with_label("xxyyyx");
        //button = gtk_viewport_new(NULL, NULL);//"GTK_WINDOW_TOPLEVEL");
        gtk_box_pack_start(GTK_BOX(vbox_main), button, TRUE, FALSE, 0);

        gtk_drag_source_set(button, GdkModifierType(GDK_BUTTON1_MASK | GDK_BUTTON3_MASK),
                            target_table, n_targets, GdkDragAction(GDK_ACTION_COPY | GDK_ACTION_MOVE));
    }

    GtkWidget *window_info = glade_xml_get_widget(gxml, "window_info");
    kim_addptr(im, "p.ui.ui.window.info", (kvoid *) window_info, RF_AUTOSET, knil, knil);

    GtkWidget *window_media = glade_xml_get_widget(gxml, "window_media");
    kim_addptr(im, "p.ui.ui.window.media", (kvoid *) window_media, RF_AUTOSET, knil, knil);

    // gtk_box_pack_start(GTK_BOX(vbox_main), window_media, TRUE, FALSE, 0);

    GtkWidget *window_pref = glade_xml_get_widget(gxml, "window_pref");
    kim_addptr(im, "p.ui.ui.window.optn", (kvoid *) window_pref, RF_AUTOSET, knil, knil);
    gtk_widget_show(window_pref);

    if (0) {
        GtkWidget *button;
        button = gtk_button_new_with_label("xxyyyx");
        gtk_box_pack_start(GTK_BOX(vbox_main), button, TRUE, TRUE, 0);
        kim_addptr(im, "p.ui.ui.window.optn", (kvoid *) button, RF_AUTOSET, knil, knil);
    }

    GtkWidget *window_tool = glade_xml_get_widget(gxml, "window_tool");
    kim_addptr(im, "p.ui.ui.window.tool", (kvoid *) window_tool, RF_AUTOSET, knil, knil);

    GtkWidget *window_tool_pool = glade_xml_get_widget(gxml, "wintool_viewport_tool_pool");
    kim_addptr(im, "p.ui.ui.window.tool_pool", (kvoid *) window_tool_pool, RF_AUTOSET, knil, knil);

    GtkWidget *window_layout_tool_pool = glade_xml_get_widget(gxml, "wintool_viewport_layout_tool_pool");
    kim_addptr(im, "p.ui.ui.window.layout_tool_pool", (kvoid *) window_layout_tool_pool, RF_AUTOSET, knil, knil);

    glade_xml_signal_autoconnect(gxml);

    glade_xml_signal_connect_data(gxml, "on_winmain_menu_item_about_activate",
                                  G_CALLBACK(on_winmain_menu_item_about_activate), NULL);
    glade_xml_signal_connect_data(gxml, "on_winmain_menu_item_tool_activate",
                                  G_CALLBACK(on_winmain_menu_item_tool_activate), NULL);
    glade_xml_signal_connect_data(gxml, "on_winmain_menu_item_pref_activate",
                                  G_CALLBACK(on_winmain_menu_item_pref_activate), NULL);
}
Exemplo n.º 9
0
PluginEditorDialog *
edit_plugin_dialog_new (void)
{
	PluginEditorDialog *dlg;
	GladeXML *gtxml;
	GtkWidget *e;
	int i;
	const char *col_titles[NCOLUMNS];

	dlg = g_malloc(sizeof(PluginEditorDialog));
	dlg->app = GNOME_APP (app_window);

	gtxml = gtt_glade_xml_new ("glade/plugin_editor.glade", "Plugin Editor");
	dlg->gtxml = gtxml;

	dlg->dialog = GTK_DIALOG (glade_xml_get_widget (gtxml,  "Plugin Editor"));

	/* ------------------------------------------------------ */
	/* Dialog dismissal buttons */
	
	glade_xml_signal_connect_data (gtxml, "on_ok_button_clicked",
		GTK_SIGNAL_FUNC (edit_plugin_commit_cb), dlg);

	glade_xml_signal_connect_data (gtxml, "on_apply_button_clicked",
		GTK_SIGNAL_FUNC (edit_plugin_apply_cb), dlg);

	glade_xml_signal_connect_data (gtxml, "on_cancel_button_clicked",
		GTK_SIGNAL_FUNC (edit_plugin_cancel_cb), dlg);

	/* ------------------------------------------------------ */
	/* Menu item add/delete buttons */
	glade_xml_signal_connect_data (gtxml, "on_add_button_clicked",
		GTK_SIGNAL_FUNC (edit_plugin_add_cb), dlg);

	glade_xml_signal_connect_data (gtxml, "on_delete_button_clicked",
		GTK_SIGNAL_FUNC (edit_plugin_delete_cb), dlg);

	/* ------------------------------------------------------ */
	/* Grab the various entry boxes and hook them up */
	e = glade_xml_get_widget (gtxml, "plugin name");
	dlg->plugin_name = GTK_ENTRY(e);

	e = glade_xml_get_widget (gtxml, "plugin path");
	dlg->plugin_path = GTK_FILE_CHOOSER(e);

	e = glade_xml_get_widget (gtxml, "plugin tooltip");
	dlg->plugin_tooltip = GTK_ENTRY(e);

	/* ------------------------------------------------------ */
	/* Inpout widget changed events */
	glade_xml_signal_connect_data (gtxml, "on_plugin_name_changed",
		GTK_SIGNAL_FUNC (edit_plugin_changed_cb), dlg);

	glade_xml_signal_connect_data (gtxml, "on_plugin_path_changed",
		GTK_SIGNAL_FUNC (edit_plugin_changed_cb), dlg);

	glade_xml_signal_connect_data (gtxml, "on_plugin_tooltip_changed",
		GTK_SIGNAL_FUNC (edit_plugin_changed_cb), dlg);

	/* ------------------------------------------------------ */
	/* Menu order change buttons */
	
	glade_xml_signal_connect_data (gtxml, "on_up_button_clicked",
		GTK_SIGNAL_FUNC (edit_plugin_up_button_cb), dlg);

	glade_xml_signal_connect_data (gtxml, "on_down_button_clicked",
		GTK_SIGNAL_FUNC (edit_plugin_down_button_cb), dlg);

	glade_xml_signal_connect_data (gtxml, "on_left_button_clicked",
		GTK_SIGNAL_FUNC (edit_plugin_left_button_cb), dlg);

	glade_xml_signal_connect_data (gtxml, "on_right_button_clicked",
		GTK_SIGNAL_FUNC (edit_plugin_right_button_cb), dlg);

	/* ------------------------------------------------------ */
	/* Set up the Treeview Widget */
	e = glade_xml_get_widget (gtxml, "editor treeview");
	dlg->treeview = GTK_TREE_VIEW (e);

	{
		GType col_type[NCOLUMNS];
		for (i=0;i<NCOLUMNS-1;i++) { col_type[i] = G_TYPE_STRING; }
		col_type[NCOLUMNS-1] = G_TYPE_POINTER;
      dlg->treestore = gtk_tree_store_newv (NCOLUMNS, col_type);
	}
	gtk_tree_view_set_model (dlg->treeview, GTK_TREE_MODEL(dlg->treestore));

	/* Set up the columns in the treeview widget */
	col_titles[0] = "Name";
	col_titles[1] = "Path";
	col_titles[2] = "Tooltip";
	for (i=0; i<NCOLUMNS-1; i++)
	{
		GtkTreeViewColumn *col;
		GtkCellRenderer *renderer;

		renderer = gtk_cell_renderer_text_new ();

		col = gtk_tree_view_column_new_with_attributes (
		                 col_titles[i],
		                 renderer, "text", i, NULL);
		
		gtk_tree_view_insert_column (dlg->treeview, col, i);
	}

	/* Copy-in existing menus from the system */
	edit_plugin_setup (dlg);

	/* Hook up the row-selection callback */
	dlg->have_selection = FALSE;
	dlg->selection = gtk_tree_view_get_selection (dlg->treeview);
	gtk_tree_selection_set_mode (dlg->selection, GTK_SELECTION_SINGLE);
	g_signal_connect (G_OBJECT (dlg->selection), "changed",
	            G_CALLBACK (edit_plugin_tree_selection_changed_cb), dlg);

	gtk_widget_hide_on_delete (GTK_WIDGET(dlg->dialog));

	return dlg;
}
Exemplo n.º 10
0
void
load_interface(cam* cam) {
    gchar *title;
    GdkPixbuf *logo = NULL;
    GtkTreeView* treeview = GTK_TREE_VIEW(glade_xml_get_widget(cam->xml, "treeview_effects"));
    GtkCellRenderer* cell;

    menu_item_filter_type = g_quark_from_static_string("camorama-menu-item-filter-type");

    /* set up the tree view */
    cell = gtk_cell_renderer_text_new();
    g_object_set(cell, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
    gtk_cell_renderer_text_set_fixed_height_from_font(GTK_CELL_RENDERER_TEXT(cell), 1);
    gtk_tree_view_insert_column_with_attributes(treeview, -1,
		    				_("Effects"), cell,
						"text", CAMORAMA_FILTER_CHAIN_COL_NAME,
						NULL);
    cam->filter_chain = camorama_filter_chain_new();
    gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(cam->filter_chain));
    g_object_unref(cam->filter_chain);
    g_signal_connect_swapped(treeview, "button-press-event",
		    	     G_CALLBACK(treeview_clicked_cb), cam);
    g_signal_connect_swapped(treeview, "popup-menu",
		    	     G_CALLBACK(treeview_popup_menu_cb), cam);

    logo = gtk_icon_theme_load_icon(gtk_icon_theme_get_for_screen(gtk_widget_get_screen(glade_xml_get_widget(cam->xml, "main_window"))), CAMORAMA_STOCK_WEBCAM, 24, 0, NULL);
    gtk_window_set_default_icon(logo);
    logo = (GdkPixbuf *) create_pixbuf (PACKAGE_DATA_DIR "/pixmaps/camorama.png");
    if (logo == NULL) {
        printf ("\n\nLOGO NO GO\n\n");
    }

    if (cam->show_adjustments == FALSE) {
        gtk_widget_hide (glade_xml_get_widget
                         (cam->xml, "adjustments_table"));

        gtk_window_resize (GTK_WINDOW
                           (glade_xml_get_widget
                            (cam->xml, "main_window")), 320, 240);
    }
    gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(cam->xml, "showadjustment_item")), cam->show_adjustments);
    if (cam->show_effects == FALSE) {
        gtk_widget_hide (glade_xml_get_widget (cam->xml, "scrolledwindow_effects"));
        gtk_window_resize (GTK_WINDOW
                           (glade_xml_get_widget
                            (cam->xml, "main_window")), 320, 240);
    }
    gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(cam->xml, "show_effects")), cam->show_effects);

    cam->tray_icon = gtk_status_icon_new_from_stock (CAMORAMA_STOCK_WEBCAM);
    update_tooltip (cam);
    /* add the status to the plug */
    g_object_set_data (G_OBJECT (cam->tray_icon), "available",
                       GINT_TO_POINTER (1));
    g_object_set_data (G_OBJECT (cam->tray_icon), "embedded",
                       GINT_TO_POINTER (0));

    g_signal_connect (cam->tray_icon, "popup-menu",
                      G_CALLBACK (tray_clicked_callback), cam);

    /* connect the signals in the interface 
     * glade_xml_signal_autoconnect(xml);
     * this won't work, can't pass data to callbacks.  have to do it individually :(*/

    title = g_strdup_printf ("Camorama - %s - %dx%d", cam->vid_cap.name,
                             cam->x, cam->y);
    gtk_window_set_title (GTK_WINDOW
                          (glade_xml_get_widget (cam->xml, "main_window")),
                          title);
    g_free (title);

    gtk_window_set_icon (GTK_WINDOW
                         (glade_xml_get_widget (cam->xml, "main_window")),
                         logo);
    gtk_window_set_icon (GTK_WINDOW
                         (glade_xml_get_widget (cam->xml, "prefswindow")),
                         logo);

    glade_xml_signal_connect_data (cam->xml, "on_show_effects_activate",
                                   G_CALLBACK (on_show_effects_activate),
                                   cam);
    gtk_toggle_button_set_active ((GtkToggleButton *)
                                  glade_xml_get_widget (cam->xml,
                                                        "togglebutton1"),
                                  cam->show_adjustments);
    glade_xml_signal_connect_data (cam->xml,
                                   "on_show_adjustments_activate",
                                   G_CALLBACK
                                   (on_show_adjustments_activate), cam);

    glade_xml_signal_connect_data (cam->xml, "on_large_activate",
                                   G_CALLBACK (on_change_size_activate), cam);
    glade_xml_signal_connect_data (cam->xml, "on_medium_activate",
                                   G_CALLBACK (on_change_size_activate), cam);
    glade_xml_signal_connect_data (cam->xml, "on_small_activate",
                                   G_CALLBACK (on_change_size_activate), cam);

    //glade_xml_signal_connect_data(cam->xml, "capture_func", G_CALLBACK(on_change_size_activate), cam);
    glade_xml_signal_connect_data (cam->xml, "capture_func",
                                   G_CALLBACK (capture_func), cam);
    glade_xml_signal_connect_data (cam->xml, "gtk_main_quit",
                                   G_CALLBACK (delete_event), NULL);

    /* sliders */
    glade_xml_signal_connect_data (cam->xml, "contrast_change",
                                   G_CALLBACK (contrast_change), cam);
    gtk_range_set_value ((GtkRange *)
                         glade_xml_get_widget (cam->xml, "slider2"),
                         (int) (cam->contrast / 256));
    glade_xml_signal_connect_data (cam->xml, "brightness_change",
                                   G_CALLBACK (brightness_change), cam);
    gtk_range_set_value ((GtkRange *)
                         glade_xml_get_widget (cam->xml, "slider3"),
                         (int) (cam->brightness / 256));
    glade_xml_signal_connect_data (cam->xml, "colour_change",
                                   G_CALLBACK (colour_change), cam);
    gtk_range_set_value ((GtkRange *)
                         glade_xml_get_widget (cam->xml, "slider4"),
                         (int) (cam->colour / 256));
    glade_xml_signal_connect_data (cam->xml, "hue_change",
                                   G_CALLBACK (hue_change), cam);
    gtk_range_set_value ((GtkRange *)
                         glade_xml_get_widget (cam->xml, "slider5"),
                         (int) (cam->hue / 256));
    glade_xml_signal_connect_data (cam->xml, "wb_change",
                                   G_CALLBACK (wb_change), cam);
    gtk_range_set_value ((GtkRange *)
                         glade_xml_get_widget (cam->xml, "slider6"),
                         (int) (cam->wb / 256));

    /* buttons */
    glade_xml_signal_connect_data (cam->xml, "on_status_show",
                                   G_CALLBACK (on_status_show),
                                   (gpointer) cam);
    glade_xml_signal_connect_data (cam->xml, "on_quit_activate",
                                   G_CALLBACK (on_quit_activate),
                                   (gpointer) cam);
    glade_xml_signal_connect_data (cam->xml, "on_preferences1_activate",
                                   G_CALLBACK (on_preferences1_activate),
                                   (gpointer) cam);
    glade_xml_signal_connect_data (cam->xml, "on_about_activate",
                                   G_CALLBACK (on_about_activate),
                                   (gpointer) cam);

    /* prefs */
    glade_xml_signal_connect_data (cam->xml, "prefs_func",
                                   G_CALLBACK (prefs_func), cam);

    /* general */
    glade_xml_signal_connect_data (cam->xml, "cap_func",
                                   G_CALLBACK (cap_func), cam);

    gtk_toggle_button_set_active ((GtkToggleButton *)
                                  glade_xml_get_widget (cam->xml,
                                                        "captured_cb"),
                                  cam->cap);

    glade_xml_signal_connect_data (cam->xml, "rcap_func",
                                   G_CALLBACK (rcap_func), cam);
    gtk_toggle_button_set_active ((GtkToggleButton *)
                                  glade_xml_get_widget (cam->xml,
                                                        "rcapture"),
                                  cam->rcap);

    glade_xml_signal_connect_data (cam->xml, "acap_func",
                                   G_CALLBACK (acap_func), cam);
    gtk_toggle_button_set_active ((GtkToggleButton *)
                                  glade_xml_get_widget (cam->xml,
                                                        "acapture"),
                                  cam->acap);

    glade_xml_signal_connect_data (cam->xml, "interval_change",
                                   G_CALLBACK (interval_change), cam);

    gtk_spin_button_set_value ((GtkSpinButton *)
                               glade_xml_get_widget (cam->xml,
                                                     "interval_entry"),
                               (cam->timeout_interval / 60000));

    /* local */
    dentry = glade_xml_get_widget (cam->xml, "dentry");
    entry2 = glade_xml_get_widget (cam->xml, "entry2");
    gtk_entry_set_text (GTK_ENTRY
                        (gnome_file_entry_gtk_entry
                         (GNOME_FILE_ENTRY (dentry))), cam->pixdir);

    gtk_entry_set_text (GTK_ENTRY (entry2), cam->capturefile);

    glade_xml_signal_connect_data (cam->xml, "append_func",
                                   G_CALLBACK (append_func), cam);
    gtk_toggle_button_set_active ((GtkToggleButton *)
                                  glade_xml_get_widget (cam->xml,
                                                        "appendbutton"),
                                  cam->timefn);

    glade_xml_signal_connect_data (cam->xml, "jpg_func",
                                   G_CALLBACK (jpg_func), cam);
    if (cam->savetype == JPEG) {
        gtk_toggle_button_set_active ((GtkToggleButton *)
                                      glade_xml_get_widget (cam->xml,
                                                            "jpgb"), TRUE);
    }
    glade_xml_signal_connect_data (cam->xml, "png_func",
                                   G_CALLBACK (png_func), cam);
    if (cam->savetype == PNG) {
        gtk_toggle_button_set_active ((GtkToggleButton *)
                                      glade_xml_get_widget (cam->xml,
                                                            "pngb"), TRUE);
    }

    glade_xml_signal_connect_data (cam->xml, "ts_func",
                                   G_CALLBACK (ts_func), cam);
    gtk_toggle_button_set_active ((GtkToggleButton *)
                                  glade_xml_get_widget (cam->xml,
                                                        "tsbutton"),
                                  cam->timestamp);

    /* remote */
    login_entry = glade_xml_get_widget (cam->xml, "login_entry");
    host_entry = glade_xml_get_widget (cam->xml, "host_entry");
    pw_entry = glade_xml_get_widget (cam->xml, "pw_entry");
    directory_entry = glade_xml_get_widget (cam->xml, "directory_entry");
    filename_entry = glade_xml_get_widget (cam->xml, "filename_entry");
    gtk_entry_set_text (GTK_ENTRY (host_entry), cam->rhost);
    gtk_entry_set_text (GTK_ENTRY (login_entry), cam->rlogin);
    gtk_entry_set_text (GTK_ENTRY (pw_entry), cam->rpw);
    gtk_entry_set_text (GTK_ENTRY (directory_entry), cam->rpixdir);
    gtk_entry_set_text (GTK_ENTRY (filename_entry), cam->rcapturefile);

    glade_xml_signal_connect_data (cam->xml, "rappend_func",
                                   G_CALLBACK (rappend_func), cam);
    gtk_toggle_button_set_active ((GtkToggleButton *)
                                  glade_xml_get_widget (cam->xml,
                                                        "timecb"),
                                  cam->rtimefn);

    glade_xml_signal_connect_data (cam->xml, "rjpg_func",
                                   G_CALLBACK (rjpg_func), cam);
    if (cam->rsavetype == JPEG) {
        gtk_toggle_button_set_active ((GtkToggleButton *)
                                      glade_xml_get_widget (cam->xml,
                                                            "fjpgb"), TRUE);
    }
    glade_xml_signal_connect_data (cam->xml, "rpng_func",
                                   G_CALLBACK (rpng_func), cam);
    if (cam->rsavetype == PNG) {
        gtk_toggle_button_set_active ((GtkToggleButton *)
                                      glade_xml_get_widget (cam->xml,
                                                            "fpngb"), TRUE);
    }

    glade_xml_signal_connect_data (cam->xml, "rts_func",
                                   G_CALLBACK (rts_func), cam);
    gtk_toggle_button_set_active ((GtkToggleButton *)
                                  glade_xml_get_widget (cam->xml,
                                                        "tsbutton2"),
                                  cam->rtimestamp);

    /* timestamp */
    glade_xml_signal_connect_data (cam->xml, "customstring_func",
                                   G_CALLBACK (customstring_func), cam);
    gtk_toggle_button_set_active ((GtkToggleButton *)
                                  glade_xml_get_widget (cam->xml, "cscb"),
                                  cam->usestring);

    string_entry = glade_xml_get_widget (cam->xml, "string_entry");
    gtk_entry_set_text (GTK_ENTRY (string_entry), cam->ts_string);

    glade_xml_signal_connect_data (cam->xml, "drawdate_func",
                                   G_CALLBACK (drawdate_func), cam);
    gtk_toggle_button_set_active ((GtkToggleButton *)
                                  glade_xml_get_widget (cam->xml, "tscb"),
                                  cam->usedate);

    cam->status = glade_xml_get_widget (cam->xml, "status");
    set_sensitive (cam);
    gtk_widget_set_sensitive (glade_xml_get_widget
                              (cam->xml, "string_entry"), cam->usestring);

    gtk_widget_set_size_request (glade_xml_get_widget (cam->xml, "da"),
                                 cam->x, cam->y);

    prefswindow = glade_xml_get_widget (cam->xml, "prefswindow");
}