コード例 #1
0
ファイル: edosu-beatmap-objects.c プロジェクト: tomtix/osux
void edosu_beatmap_load_objects(EdosuBeatmap *beatmap, osux_beatmap *osux_bm)
{
    GtkTreeStore *ts;
    ts = gtk_tree_store_new(COL_NUM,
                            G_TYPE_INT, G_TYPE_STRING,
                            G_TYPE_STRING, G_TYPE_POINTER);
    beatmap->Objects = ts;
    gtk_tree_store_append(ts, &beatmap->TimingPoints, NULL);
    gtk_tree_store_set(ts, &beatmap->TimingPoints, COL_TYPE, _("TimingPoints"),
                       COL_OFFSET, osux_bm->timingpoint_count, -1);
    load_timing_points(osux_bm, ts, &beatmap->TimingPoints);

    gtk_tree_store_append(ts, &beatmap->HitObjects, NULL);
    gtk_tree_store_set(ts, &beatmap->HitObjects, COL_TYPE, _("HitObjects"),
                       COL_OFFSET, osux_bm->hitobject_count, -1);
    load_hit_objects(osux_bm, ts, beatmap->HitObjectsSeq, &beatmap->HitObjects);

    gtk_tree_store_append(ts, &beatmap->Bookmarks, NULL);
    gtk_tree_store_set(ts, &beatmap->Bookmarks, COL_TYPE, _("Bookmarks"),
                       COL_OFFSET, osux_bm->bookmark_count, -1);
    load_bookmarks(osux_bm, ts, &beatmap->Bookmarks);

    gtk_tree_store_append(ts, &beatmap->Events, NULL);
    gtk_tree_store_set(ts, &beatmap->Events, COL_TYPE, _("Events"),
                       COL_OFFSET, osux_bm->event_count, -1);
    load_events(osux_bm, ts, &beatmap->Events);

    gtk_tree_store_append(ts, &beatmap->Colors, NULL);
    gtk_tree_store_set(ts, &beatmap->Colors, COL_TYPE, _("Colors"),
                       COL_OFFSET, osux_bm->color_count, -1);
    load_colors(osux_bm, ts, &beatmap->Colors);

    edosu_beatmap_steal_objects(beatmap, osux_bm);
}
コード例 #2
0
ファイル: fm-bookmarks.c プロジェクト: juergenhoetzel/libfm
static void fm_bookmarks_init(FmBookmarks *self)
{
    GList* items = NULL;
    char* fpath = get_bookmarks_file();
    GFile* gf = g_file_new_for_path(fpath);
	self->mon = g_file_monitor_file(gf, 0, NULL, NULL);
    g_object_unref(gf);
    g_signal_connect(self->mon, "changed", G_CALLBACK(on_changed), self);

    self->items = load_bookmarks(fpath);
    g_free(fpath);
}
コード例 #3
0
ファイル: fm-bookmarks.c プロジェクト: juergenhoetzel/libfm
static void on_changed( GFileMonitor* mon, GFile* gf, GFile* other, 
                    GFileMonitorEvent evt, FmBookmarks* bookmarks )
{
    char* fpath;
    /* reload bookmarks */
    g_list_foreach(bookmarks->items, (GFunc)free_item, NULL);
    g_list_free(bookmarks->items);

    fpath = get_bookmarks_file();
    bookmarks->items = load_bookmarks(fpath);
    g_free(fpath);
    g_signal_emit(bookmarks, signals[CHANGED], 0);
}
コード例 #4
0
ファイル: bookmarkdialog.cpp プロジェクト: benedictb/Browser
BookmarkDialog::BookmarkDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::BookmarkDialog)
{
    ui->setupUi(this); //load ui
    load_bookmarks(); //load bookmarks
    ui->bookmarkView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    //non-editable list

    QStringListModel * model = new QStringListModel(this);

    for (it = bkmks.begin(); it != bkmks.end(); it++){ //load the list of bookmarks into the new Qlist
        list<< QString::fromStdString(*(it)); //using an iterator to move through the list
    }
    model->setStringList(list); //load the Qstringlist into the ui

    ui->bookmarkView->setModel(model);//load the Qstringlist into the ui

    ui->bookmarkView->setCurrentIndex(ui->bookmarkView->model()->index(0, 0)); //highlight one to avoid segfaults

}
コード例 #5
0
static void
load_bookmark_metadata (PlumaView *view)
{
	PlumaDocument *doc;
	gchar *bookmarks_attr;

	doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
	bookmarks_attr = pluma_document_get_metadata (doc, METADATA_ATTR);

	if (bookmarks_attr != NULL)
	{
		gchar **bookmarks;

		bookmarks = g_strsplit (bookmarks_attr, ",", -1);
		g_free (bookmarks_attr);

		load_bookmarks (view, bookmarks);

		g_strfreev (bookmarks);
	}
}
コード例 #6
0
ファイル: main-win.c プロジェクト: gilir/libfm-debian
static void fm_main_win_init(FmMainWin *self)
{
    GtkWidget *vbox, *menubar, *toolitem, *next_btn, *scroll;
    GtkUIManager* ui;
    GtkActionGroup* act_grp;
    GtkAction* act;
    GtkAccelGroup* accel_grp;

    ++n_wins;

    vbox = gtk_vbox_new(FALSE, 0);

    self->hpaned = gtk_hpaned_new();
    gtk_paned_set_position(GTK_PANED(self->hpaned), 150);

    /* places left pane */
    self->places_view = fm_places_view_new();
    scroll = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
    gtk_container_add(GTK_CONTAINER(scroll), self->places_view);
    gtk_paned_add1(GTK_PANED(self->hpaned), scroll);

    /* folder view */
    self->folder_view = fm_folder_view_new( FM_FV_ICON_VIEW );
    fm_folder_view_set_show_hidden(FM_FOLDER_VIEW(self->folder_view), FALSE);
    fm_folder_view_sort(FM_FOLDER_VIEW(self->folder_view), GTK_SORT_DESCENDING, COL_FILE_NAME);
    fm_folder_view_set_selection_mode(FM_FOLDER_VIEW(self->folder_view), GTK_SELECTION_MULTIPLE);
    g_signal_connect(self->folder_view, "clicked", on_file_clicked, self);
    g_signal_connect(self->folder_view, "status", on_status, self);
    g_signal_connect(self->folder_view, "sel-changed", on_sel_changed, self);

    gtk_paned_add2(GTK_PANED(self->hpaned), self->folder_view);

    /* link places view with folder view. */
    g_signal_connect_swapped(self->places_view, "chdir", G_CALLBACK(fm_main_win_chdir), self);

    /* create menu bar and toolbar */
    ui = gtk_ui_manager_new();
    act_grp = gtk_action_group_new("Main");
    gtk_action_group_add_actions(act_grp, main_win_actions, G_N_ELEMENTS(main_win_actions), self);
    gtk_action_group_add_toggle_actions(act_grp, main_win_toggle_actions, G_N_ELEMENTS(main_win_toggle_actions), self);
    gtk_action_group_add_radio_actions(act_grp, main_win_mode_actions, G_N_ELEMENTS(main_win_mode_actions), FM_FV_ICON_VIEW, on_change_mode, self);
    gtk_action_group_add_radio_actions(act_grp, main_win_sort_type_actions, G_N_ELEMENTS(main_win_sort_type_actions), GTK_SORT_ASCENDING, on_sort_type, self);
    gtk_action_group_add_radio_actions(act_grp, main_win_sort_by_actions, G_N_ELEMENTS(main_win_sort_by_actions), 0, on_sort_by, self);

    accel_grp = gtk_ui_manager_get_accel_group(ui);
    gtk_window_add_accel_group(GTK_WINDOW(self), accel_grp);

    gtk_ui_manager_insert_action_group(ui, act_grp, 0);
    gtk_ui_manager_add_ui_from_string(ui, main_menu_xml, -1, NULL);

    menubar = gtk_ui_manager_get_widget(ui, "/menubar");

    self->toolbar = gtk_ui_manager_get_widget(ui, "/toolbar");
    /* FIXME: should make these optional */
    gtk_toolbar_set_icon_size(GTK_TOOLBAR(self->toolbar), GTK_ICON_SIZE_SMALL_TOOLBAR);
    gtk_toolbar_set_style(GTK_TOOLBAR(self->toolbar), GTK_TOOLBAR_ICONS);

    /* create 'Next' button manually and add a popup menu to it */
    toolitem = g_object_new(GTK_TYPE_MENU_TOOL_BUTTON, NULL);
    gtk_toolbar_insert(GTK_TOOLBAR(self->toolbar), toolitem, 2);
    gtk_widget_show(GTK_WIDGET(toolitem));
    act = gtk_ui_manager_get_action(ui, "/menubar/GoMenu/Next");
    gtk_activatable_set_related_action(GTK_ACTIVATABLE(toolitem), act);

    /* set up history menu */
    self->nav_history = fm_nav_history_new();
    self->history_menu = gtk_menu_new();
    gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolitem), self->history_menu);
    g_signal_connect(toolitem, "show-menu", G_CALLBACK(on_show_history_menu), self);

    self->popup = gtk_ui_manager_get_widget(ui, "/popup");

    gtk_box_pack_start( (GtkBox*)vbox, menubar, FALSE, TRUE, 0 );
    gtk_box_pack_start( (GtkBox*)vbox, self->toolbar, FALSE, TRUE, 0 );

    /* load bookmarks menu */
    load_bookmarks(self, ui);

    /* the location bar */
    self->location = fm_path_entry_new();
    g_signal_connect(self->location, "activate", on_entry_activate, self);
    g_signal_connect(self->folder_view, "loaded", G_CALLBACK(on_view_loaded), (gpointer) self);

    toolitem = gtk_tool_item_new();
    gtk_container_add( GTK_CONTAINER(toolitem), self->location );
    gtk_tool_item_set_expand(GTK_TOOL_ITEM(toolitem), TRUE);
    gtk_toolbar_insert((GtkToolbar*)self->toolbar, toolitem, gtk_toolbar_get_n_items(GTK_TOOLBAR(self->toolbar)) - 1 );

    gtk_box_pack_start( (GtkBox*)vbox, self->hpaned, TRUE, TRUE, 0 );

    /* status bar */
    self->statusbar = gtk_statusbar_new();
    gtk_box_pack_start( (GtkBox*)vbox, self->statusbar, FALSE, TRUE, 0 );
    self->statusbar_ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(self->statusbar), "status");
    self->statusbar_ctx2 = gtk_statusbar_get_context_id(GTK_STATUSBAR(self->statusbar), "status2");

    g_object_unref(act_grp);
    self->ui = ui;

    gtk_container_add( (GtkContainer*)self, vbox );
    gtk_widget_show_all(vbox);

    fm_folder_view_set_show_hidden(FM_FOLDER_VIEW(self->folder_view), FALSE);
    fm_main_win_chdir(self, fm_path_get_home());

    gtk_widget_grab_focus(self->folder_view);
}