本文整理汇总了C++中GTK_TREE_SELECTION函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_TREE_SELECTION函数的具体用法?C++ GTK_TREE_SELECTION怎么用?C++ GTK_TREE_SELECTION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_TREE_SELECTION函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clip_GTK_TREESELECTIONGETSELECTED
int
clip_GTK_TREESELECTIONGETSELECTED(ClipMachine * cm)
{
C_object *ctreesel = _fetch_co_arg(cm);
C_object *cmodel = _fetch_cobject(cm, _clip_par(cm, 2));
ClipVar *cviter = _clip_par(cm, 3);
C_object *citer;
GtkTreeModel *model;
gboolean ret;
CHECKOPT2(1, MAP_t, NUMERIC_t); CHECKCOBJ(ctreesel,GTK_IS_TREE_SELECTION(ctreesel->object));
memset(Iter, 0, sizeof(Iter));
if (cmodel)
{
model = GTK_TREE_MODEL(cmodel->object);
ret = gtk_tree_selection_get_selected(GTK_TREE_SELECTION(ctreesel->object),
&model, Iter);
}
else
ret = gtk_tree_selection_get_selected(GTK_TREE_SELECTION(ctreesel->object),
NULL, Iter);
if (ret && Iter)
{
citer = _list_get_cobject(cm,Iter);
if (!citer) citer = _register_object(cm,Iter,GTK_TYPE_TREE_ITER, cviter, NULL);
if (citer) _clip_mclone(cm, cviter,&citer->obj);
}
_clip_retl(cm, ret);
return 0;
err:
return 1;
}
示例2: file_selected
/* file_selected
* Acts as the callback for when a file is selected from the directory treeview.
* Refills the hex buffers with data at the selection. Also allows for folder navigation.
*/
void file_selected (GtkWidget *selection, gpointer data) {
GtkTreeModel *model;
GtkTreeIter iter;
if (gtk_tree_selection_get_selected (GTK_TREE_SELECTION(selection),
&model, &iter)) {
gchar *file_path;
gtk_tree_model_get (model, &iter, FILE_NAME, &file_path, -1);
//g_message("selected %s\n", file_path);
gchar *permissions;
gtk_tree_model_get (model, &iter, PERMISSIONS, &permissions, -1);
if(permissions[0] != '-'){
return;
//This code allows for navigation in the dir view but no thanks.
if(permissions[0] == 'd'){
if(remakeDirectoryView(directory_treeview,file_path) != 0){
fprintf(stderr,"Unable To Build File Directory View Panel.\n");
}
}
return;
}
if(rebuildHexPanel (hex_offset_textview, hex_textview, hex_text_textview,file_path) != 0){
fprintf(stderr,"Unable to Build Hex Panel.\n");
}
}
}
示例3: cancelDownloadCallback
static void cancelDownloadCallback(GtkWidget *button, BrowserDownloadDialog *dialog)
{
GtkTreeModel * model;
GtkTreeIter iter;
WebKitDownload *wkDownload;
if (gtk_tree_selection_get_selected(GTK_TREE_SELECTION(dialog->select), &model, &iter))
{
gtk_tree_model_get (GTK_TREE_MODEL(dialog->model), &iter, 7, &wkDownload, -1);
if(wkDownload)
{
webkit_download_cancel(WEBKIT_DOWNLOAD(wkDownload));
gtk_list_store_remove(dialog->model, &iter);
return;
}
char *treeviewIndex = g_strdup_printf("%s", gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(dialog->model), &iter));
if(treeviewIndex)
{
size_t listIndex = atoi(treeviewIndex);
DeleteList(dialog->download,listIndex);
}
g_printerr("store_remove\n");
gtk_list_store_remove(dialog->model, &iter);
}
}
示例4: usun_obj
void usun_obj(GtkWidget *widget, gpointer selection)
{
GtkListStore *store;
GtkTreeModel *model;
GtkTreeIter iter;
store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW (lista_obj_gui)));
model = gtk_tree_view_get_model(GTK_TREE_VIEW(lista_obj_gui));
if(gtk_tree_model_get_iter_first(model, &iter) == FALSE)
return;
if(gtk_tree_selection_get_selected(GTK_TREE_SELECTION(selection), &model, &iter))
{
wezel *red;
gtk_tree_model_get(model, &iter, 1, &red, -1);
int poz = szukaj_wartosci(lista_obj, red->wartosc);
if(poz != -1)
lista_obj = usun_z_pozycji(lista_obj, poz);
else
{
pokaz_error("Uwaga! Wyciek pamieci spowodowany nieusunieciem obiektu (chociaz uzytkownikowi zniknal on z oczu)!");
// teoretycznie nigdy program nie powinien tutaj dojsc...
}
gtk_list_store_remove(store, &iter);
}
}
示例5: gtkui_connection_kill
/*
* kill the selected connection connection
*/
static void gtkui_connection_kill(void *conn)
{
GtkTreeIter iter;
GtkTreeModel *model;
struct conn_tail *c = NULL;
DEBUG_MSG("gtkui_connection_kill");
model = GTK_TREE_MODEL (ls_conns);
if (gtk_tree_selection_get_selected (GTK_TREE_SELECTION (selection), &model, &iter)) {
gtk_tree_model_get (model, &iter, 9, &c, -1);
} else
return; /* nothing is selected */
if (!c || !c->co)
return;
/* kill it */
switch (user_kill(c->co)) {
case ESUCCESS:
/* set the status */
c->co->status = CONN_KILLED;
gtkui_message("The connection was killed !!");
break;
case -EFATAL:
gtkui_message("Cannot kill UDP connections !!");
break;
}
}
示例6: clip_GTK_TREEGETSELECTION
int
clip_GTK_TREEGETSELECTION(ClipMachine * ClipMachineMemory)
{
C_widget *ctree = _fetch_cw_arg(ClipMachineMemory);
GList *list;
CHECKCWID(ctree, GTK_IS_TREE);
list = GTK_TREE_SELECTION(ctree->widget);
if (list)
{
C_widget *citem;
long l = g_list_length(list);
ClipVar *a = RETPTR(ClipMachineMemory);
_clip_array(ClipMachineMemory, a, 1, &l);
for (l = 0; list; list = g_list_next(list), l++)
{
citem = _get_cwidget(ClipMachineMemory, list->data);
if (citem)
_clip_aset(ClipMachineMemory, a, &citem->obj, 1, &l);
}
}
return 0;
err:
return 1;
}
示例7: main
int main(void) {
preparation_t queries[] = {
{ "rate",
"SELECT connectionStrength((select id from mode),$2,$1)" },
{ "getpage",
"select strength,title,songs.id from connections inner join songs on connections.blue = songs.id where red = (select id from mode) order by strength desc OFFSET $1 LIMIT $2;" }
};
PQinit();
gtk_init(NULL,NULL);
prepareQueries(queries);
GtkBuilder* builder = gtk_builder_new_from_string(gladeFile,gladeFileSize);
GtkWidget* top = GTK_WIDGET(gtk_builder_get_object(builder,"top"));
GtkTreeSelection* selection = GTK_TREE_SELECTION(
gtk_builder_get_object(builder,"song-selection"));
GtkButton* rateup = GTK_BUTTON(
gtk_builder_get_object(builder,"rateup"));
GtkButton* ratedown = GTK_BUTTON(
gtk_builder_get_object(builder,"ratedown"));
g_signal_connect(G_OBJECT(rateup),"clicked",G_CALLBACK(yay),selection);
g_signal_connect(G_OBJECT(ratedown),"clicked",G_CALLBACK(nay),selection);
GtkListStore* model = GTK_LIST_STORE(
gtk_builder_get_object(builder,"songs"));
fillNext(selection,model);
gtk_widget_show_all(top);
gtk_main();
}
示例8: button11_treeview_fun
void button11_treeview_fun(GtkWidget *window,gpointer data)//启动并进入容器
{
GtkTreeIter iter22;
GtkTreeModel *mod22;
GtkMessageType type;
mod22=gtk_tree_view_get_model (GTK_TREE_VIEW(window));
static char *ss=NULL;
static char *tmp=NULL;
ss=(char *)malloc(sizeof(char)*100);
tmp=(char *)malloc(sizeof(char)*100);
//gtk_tree_selection_get_selected (GTK_TREE_SELECTION(data),&mod22,&iter22);
//gtk_tree_model_get(GTK_TREE_MODEL(mod22),&iter22,1,&ss,-1);
if(gtk_tree_selection_get_selected (GTK_TREE_SELECTION(data),&mod22,&iter22))
{
//system("ls");
gtk_tree_model_get(GTK_TREE_MODEL(mod22),&iter22,1,&ss,-1);
sprintf(tmp,"sudo gnome-terminal -x bash -c \"sudo docker start -i %s\"",ss);
g_thread_new("dockr_start",docker_contain_start,tmp);
printf("%s\n",ss);
printf("%s\n",tmp);
g_free(ss);
}
else{
contains_message(GTK_MESSAGE_ERROR,_("Choose a line of content"));
}
}
示例9: Picture_Entry_View_Button_Pressed
/*
* If double clicking the PictureEntryView :
* - over a selected row : opens properties window
* - over an empty area : open the adding window
*/
gboolean Picture_Entry_View_Button_Pressed (GtkTreeView *treeview, GdkEventButton *event, gpointer data)
{
if (event->type == GDK_BUTTON_PRESS && event->button == 1)
{
if (event->window == gtk_tree_view_get_bin_window (treeview))
{
if (!gtk_tree_view_get_path_at_pos (treeview, event->x, event->y,
NULL, NULL, NULL, NULL))
{
gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (treeview));
}
}
}
if (event->type==GDK_2BUTTON_PRESS && event->button==1)
{
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(PictureEntryView));
if (gtk_tree_selection_count_selected_rows (GTK_TREE_SELECTION (selection)) >= 1)
Picture_Properties_Button_Clicked (G_OBJECT (image_properties_toolitem));
else
Picture_Add_Button_Clicked (G_OBJECT (add_image_toolitem));
return TRUE;
}
return FALSE;
}
示例10: openDirCallback
static void openDirCallback(GtkWidget *button, BrowserDownloadDialog *dialog)
{
GtkTreeModel * model;
GtkTreeIter iter;
gchar *path_file;
if (gtk_tree_selection_get_selected(GTK_TREE_SELECTION(dialog->select), &model, &iter))
{
gtk_tree_model_get (GTK_TREE_MODEL(dialog->model), &iter, 6, &path_file, -1);
if(path_file)
{
int path_len = strlen(path_file) - strlen(g_strrstr(path_file , "/"));
gchar *download_path = (char*)malloc(path_len*sizeof(char)+1);
memset(download_path, 0x00, path_len+1);
memcpy(download_path, path_file, path_len);
char *argv[] = {"xdg-open", download_path, NULL} ;
g_spawn_async( NULL, (gchar **)argv, NULL, (GSpawnFlags)(G_SPAWN_SEARCH_PATH |
G_SPAWN_STDOUT_TO_DEV_NULL |
G_SPAWN_STDERR_TO_DEV_NULL |
G_SPAWN_STDERR_TO_DEV_NULL),
NULL, NULL, NULL, NULL );
g_free(download_path);
g_free(path_file);
}
}
}
示例11: net_connection_editor_init
static void
net_connection_editor_init (NetConnectionEditor *editor)
{
GError *error = NULL;
GtkTreeSelection *selection;
editor->builder = gtk_builder_new ();
gtk_builder_add_from_resource (editor->builder,
"/org/gnome/control-center/network/connection-editor.ui",
&error);
if (error != NULL) {
g_warning ("Could not load ui file: %s", error->message);
g_error_free (error);
return;
}
editor->window = GTK_WIDGET (gtk_builder_get_object (editor->builder, "details_dialog"));
selection = GTK_TREE_SELECTION (gtk_builder_get_object (editor->builder,
"details_page_list_selection"));
g_signal_connect (selection, "changed",
G_CALLBACK (selection_changed), editor);
editor->scrolled_window = GTK_WIDGET (gtk_builder_get_object (editor->builder, "toplevel_scrolled_window"));
}
示例12: gtk_tree_selection_get_tree_view
Php::Value GtkTreeSelection_::get_tree_view()
{
GtkTreeView *ret = gtk_tree_selection_get_tree_view (GTK_TREE_SELECTION(instance));
GtkTreeView_ *return_parsed = new GtkTreeView_();
return_parsed->set_instance((gpointer *)ret);
return Php::Object("GtkTreeView", return_parsed);
}
示例13: gtk_tree_path_new_from_string
void GtkTreeSelection_::unselect_path(Php::Parameters ¶meters)
{
std::string param_path = parameters[0];
GtkTreePath *path = gtk_tree_path_new_from_string(param_path.c_str());
gtk_tree_selection_unselect_path (GTK_TREE_SELECTION(instance), path);
}
示例14: gtk_tree_selection_set_mode
void GtkTreeSelection_::set_mode(Php::Parameters ¶meters)
{
int int_type = (int)parameters[0];
GtkSelectionMode type = (GtkSelectionMode)int_type;
gtk_tree_selection_set_mode (GTK_TREE_SELECTION(instance), type);
}
示例15: tabu_playlist_init
static void
tabu_playlist_init (TabuPlaylist *self)
{
self->tree_view = gtk_tree_view_new ( );
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (self->tree_view), FALSE);
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (self->tree_view), TRUE);
gtk_tree_selection_set_mode (
GTK_TREE_SELECTION (
gtk_tree_view_get_selection (GTK_TREE_VIEW (self->tree_view))),
GTK_SELECTION_SINGLE);
self->cell_renderer = gtk_cell_renderer_text_new ();
self->tree_view_column = gtk_tree_view_column_new_with_attributes(
"",
self->cell_renderer,
"markup", 0,
NULL );
gtk_tree_view_insert_column (
GTK_TREE_VIEW (self->tree_view),
self->tree_view_column,
-1);
self->list_store = gtk_list_store_new (
2,
G_TYPE_STRING,
G_TYPE_STRING );
gtk_tree_view_set_model (
GTK_TREE_VIEW (self->tree_view),
GTK_TREE_MODEL (self->list_store));
/*
g_signal_connect (
G_OBJECT (self->tree_view),
"row-activated",
G_CALLBACK (playlist_row_activated_callback),
NULL);
g_signal_connect (
G_OBJECT (self->tree_view),
"key-press-event",
G_CALLBACK (playlist_key_press_callback),
NULL);
*/
gtk_scrolled_window_set_policy (
GTK_SCROLLED_WINDOW (self),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (
GTK_CONTAINER ( GTK_SCROLLED_WINDOW (self)),
GTK_WIDGET (self->tree_view));
}