本文整理汇总了C++中GTK_CLIST函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_CLIST函数的具体用法?C++ GTK_CLIST怎么用?C++ GTK_CLIST使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_CLIST函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clist_selected
static void clist_selected(GtkWidget *widget, gint row, gint column,
GdkEventButton *event, gpointer data)
{
int connect_sensitive = 0;
int disconnect_sensitive = 0;
int forget_sensitive = 0;
int verify_sensitive = 0;
Fingerprint *f = gtk_clist_get_row_data(GTK_CLIST(ui_layout.keylist),
row);
ConnContext *context_iter;
if (f) {
verify_sensitive = 1;
forget_sensitive = 1;
if (f->context && f->context->m_context) {
for (context_iter = f->context;
context_iter && context_iter->m_context ==
f->context->m_context;
context_iter = context_iter->next) {
if (context_iter->msgstate == OTRL_MSGSTATE_ENCRYPTED &&
context_iter->active_fingerprint == f) {
disconnect_sensitive = 1;
forget_sensitive = 0;
}
else if (context_iter->msgstate == OTRL_MSGSTATE_FINISHED) {
disconnect_sensitive = 1;
connect_sensitive = 1;
}
else if (context_iter->msgstate == OTRL_MSGSTATE_PLAINTEXT) {
connect_sensitive = 1;
}
}
}
}
gtk_widget_set_sensitive(ui_layout.connect_button,
connect_sensitive);
gtk_widget_set_sensitive(ui_layout.disconnect_button,
disconnect_sensitive);
gtk_widget_set_sensitive(ui_layout.forget_button, forget_sensitive);
gtk_widget_set_sensitive(ui_layout.verify_button, verify_sensitive);
ui_layout.selected_fprint = f;
}
示例2: add_filter_callback_2
static void add_filter_callback_2(GtkWidget *widget, GtkWidget *nothing)
{
int i;
GtkCList *cl;
if(!GLOBALS->filesel_ok) { return; }
if(*GLOBALS->fileselbox_text)
{
for(i=0;i<GLOBALS->num_ttrans_filters;i++)
{
if(GLOBALS->ttranssel_filter[i])
{
if(!strcmp(GLOBALS->ttranssel_filter[i], *GLOBALS->fileselbox_text))
{
status_text("Filter already imported.\n");
if(GLOBALS->is_active_ttranslate_c_2) gdk_window_raise(GLOBALS->window_ttranslate_c_5->window);
return;
}
}
}
}
GLOBALS->num_ttrans_filters++;
load_ttrans_filter(GLOBALS->num_ttrans_filters, *GLOBALS->fileselbox_text);
if(GLOBALS->ttrans_filter[GLOBALS->num_ttrans_filters])
{
if(GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters]) free_2(GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters]);
GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters] = malloc_2(strlen(*GLOBALS->fileselbox_text) + 1);
strcpy(GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters], *GLOBALS->fileselbox_text);
cl=GTK_CLIST(GLOBALS->clist_ttranslate_c_2);
gtk_clist_freeze(cl);
gtk_clist_append(cl,(gchar **)&(GLOBALS->ttranssel_filter[GLOBALS->num_ttrans_filters]));
gtk_clist_set_column_width(cl,0,gtk_clist_optimal_column_width(cl,0));
gtk_clist_thaw(cl);
}
else
{
GLOBALS->num_ttrans_filters--;
}
if(GLOBALS->is_active_ttranslate_c_2) gdk_window_raise(GLOBALS->window_ttranslate_c_5->window);
}
示例3: gradient_select_rename_all
void
gradient_select_rename_all (gradient_t *gradient)
{
GradientSelect *gsp;
GSList *list;
gint row;
for (list = gradient_active_dialogs; list; list = g_slist_next (list))
{
gsp = (GradientSelect *) list->data;
row = gtk_clist_find_row_from_data (GTK_CLIST (gsp->clist), gradient);
/*
if (row > -1)
gtk_clist_set_text (GTK_CLIST (gsp->clist), row, 1, gradient->name);
*/
}
}
示例4: imp_ldif_modify_pressed
static void imp_ldif_modify_pressed( GtkWidget *widget, gpointer data ) {
GtkCList *clist = GTK_CLIST(impldif_dlg.clist_field);
Ldif_FieldRec *rec;
gint row;
if( impldif_dlg.rowIndSelect < 0 ) return;
row = impldif_dlg.rowIndSelect;
rec = gtk_clist_get_row_data( clist, impldif_dlg.rowIndSelect );
g_free( rec->userName );
rec->userName = gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.name_attrib), 0, -1 );
rec->selected = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( impldif_dlg.check_select) );
imp_ldif_update_row( clist );
gtk_clist_select_row( clist, row, 0 );
gtk_label_set_text( GTK_LABEL(impldif_dlg.name_ldif), "" );
gtk_entry_set_text( GTK_ENTRY(impldif_dlg.name_attrib), "" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( impldif_dlg.check_select), FALSE );
}
示例5: GTK_CLIST
GtkWidget *gtk_clist_new(gint columns)
{
GtkCList *clist;
int i;
clist = GTK_CLIST(GtkNewObject(&GtkCListClass));
clist->cols = columns;
clist->coldata = g_new0(GtkCListColumn, columns);
clist->rows = 0;
clist->rowdata = NULL;
for (i = 0; i < columns; i++) {
clist->coldata[i].width = 0;
clist->coldata[i].visible = TRUE;
clist->coldata[i].resizeable = TRUE;
}
return GTK_WIDGET(clist);
}
示例6: on_rule_new_rule_clicked
void
on_rule_new_rule_clicked (GtkButton * button, gpointer UNUSED(user_data))
{
rule *r;
int x;
GtkCList *clist;
r = (rule *) malloc (sizeof (rule));
r->regex = g_strdup ("");
r->mbox = g_strdup ("Inbox");
r->name = g_strdup ("New rule");
r->piece = g_strdup ("Header");
clist = GTK_CLIST (lookup_widget (GTK_WIDGET (button), "clist1"));
x = clist->rows;
gtk_clist_insert (clist, x, &(r->name));
gtk_clist_set_row_data (clist, x, r);
gtk_clist_select_row (clist, x, 0);
}
示例7: nodes_gui_update_node_info
/**
* Update the row with the given nodeinfo. If row is -1 the row number
* is determined by the node_id contained in the gnet_node_info_t.
*/
static void
nodes_gui_update_node_info(gnet_node_info_t *n, gint row)
{
GtkCList *clist = GTK_CLIST(gui_main_window_lookup("clist_nodes"));
g_assert(n != NULL);
if (row == -1) {
row = gtk_clist_find_row_from_data(clist,
deconstify_gpointer(n->node_id));
}
if (row != -1) {
gchar ver_buf[64];
gnet_node_status_t status;
time_t now = tm_time();
if (guc_node_get_status(n->node_id, &status)) {
gtk_clist_set_text(clist, row, c_gnet_user_agent,
n->vendor ? lazy_utf8_to_locale(n->vendor) : "...");
gtk_clist_set_text(clist, row, c_gnet_loc,
deconstify_gchar(iso3166_country_cc(n->country)));
str_bprintf(ver_buf, sizeof ver_buf, "%d.%d",
n->proto_major, n->proto_minor);
gtk_clist_set_text(clist, row, c_gnet_version, ver_buf);
if (status.status == GTA_NODE_CONNECTED)
gtk_clist_set_text(clist, row, c_gnet_connected,
short_uptime(delta_time(now, status.connect_date)));
if (status.up_date)
gtk_clist_set_text(clist, row, c_gnet_uptime,
status.up_date
? short_uptime(delta_time(now, status.up_date)) : "...");
gtk_clist_set_text(clist, row, c_gnet_info,
nodes_gui_common_status_str(&status));
}
} else {
g_warning("%s(): no matching row found", G_STRFUNC);
}
}
示例8: widget_table_input_by_command
static void widget_table_input_by_command(variable *var, char *filename,
gint command_or_file)
{
FILE *infile;
gchar line[512];
gint count;
list_t *sliced;
#ifdef DEBUG_TRANSITS
fprintf(stderr, "%s(): Entering.\n", __func__);
#endif
#if !GTK_CHECK_VERSION(3,0,0) /* gtk3: Deprecated in gtk2 and now gone */
if (command_or_file) {
infile = widget_opencommand(filename);
} else {
infile = fopen(filename, "r");
}
/* Opening pipe for reading... */
if (infile) {
/* Read the file one line at a time (trailing [CR]LFs are read too) */
while (fgets(line, 512, infile) != NULL) {
/* Enforce end of string in case of max chars read */
line[512 - 1] = 0;
/* Remove the trailing [CR]LFs */
for (count = strlen(line) - 1; count >= 0; count--)
if (line[count] == 13 || line[count] == 10) line[count] = 0;
sliced = linecutter(g_strdup(line), '|');
gtk_clist_append(GTK_CLIST(var->Widget), sliced->line);
if (sliced) list_t_free(sliced); /* Free linecutter memory */
}
/* Close the file */
pclose(infile);
} else {
fprintf(stderr, "%s(): Couldn't open '%s' for reading.\n", __func__,
filename);
}
#endif
#ifdef DEBUG_TRANSITS
fprintf(stderr, "%s(): Exiting.\n", __func__);
#endif
}
示例9: update_row
static void
update_row (int row,
XSettingsSetting *setting)
{
char buffer[256];
GtkStyle *style;
const char *type;
if (setting->type != XSETTINGS_TYPE_COLOR)
gtk_clist_set_cell_style (GTK_CLIST (settings_clist),
row, VALUE, NULL);
switch (setting->type)
{
case XSETTINGS_TYPE_INT:
type = "INT";
sprintf (buffer, "%d", setting->data.v_int);
gtk_clist_set_text (GTK_CLIST (settings_clist), row, VALUE, buffer);
break;
case XSETTINGS_TYPE_STRING:
type = "STRING";
gtk_clist_set_text (GTK_CLIST (settings_clist), row, VALUE, setting->data.v_string);
break;
case XSETTINGS_TYPE_COLOR:
type = "COLOR";
gtk_clist_set_text (GTK_CLIST (settings_clist), row, VALUE, "");
style = gtk_style_copy (settings_clist->style);
style->base[GTK_STATE_NORMAL].red = setting->data.v_color.red;
style->base[GTK_STATE_NORMAL].green = setting->data.v_color.green;
style->base[GTK_STATE_NORMAL].blue = setting->data.v_color.blue;
style->bg[GTK_STATE_SELECTED].red = setting->data.v_color.red;
style->bg[GTK_STATE_SELECTED].green = setting->data.v_color.green;
style->bg[GTK_STATE_SELECTED].blue = setting->data.v_color.blue;
gtk_clist_set_cell_style (GTK_CLIST (settings_clist),
row, VALUE, style);
gtk_style_unref (style);
break;
default:
g_assert_not_reached ();
}
gtk_clist_set_text (GTK_CLIST (settings_clist), row, TYPE, type);
sprintf (buffer, "%ld", setting->last_change_serial);
gtk_clist_set_text (GTK_CLIST (settings_clist), row, SERIAL, buffer);
}
示例10: eqSetChannelNames
static void eqSetChannelNames( void )
{
gchar * str[2];
gtk_clist_clear( GTK_CLIST( ChannelsList ) );
str[1]="";
str[0]=MSGTR_EQU_All;
gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
if ( guiIntfStruct.AudioType > 1 )
{
str[0]=gtkEquChannel1; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
str[0]=gtkEquChannel2; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
}
if ( guiIntfStruct.AudioType > 2 )
{
str[0]=gtkEquChannel3; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
str[0]=gtkEquChannel4; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
}
if ( guiIntfStruct.AudioType > 4 )
{
str[0]=gtkEquChannel5; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
str[0]=gtkEquChannel6; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
}
gtk_clist_select_row( GTK_CLIST( ChannelsList ),0,0 );
}
示例11: gnc_query_list_toggle
static void
gnc_query_list_toggle (GNCQueryList *list)
{
gpointer entry;
gint row;
g_return_if_fail (IS_GNC_QUERY_LIST(list));
if (list->no_toggle)
return;
row = list->current_row;
entry = gtk_clist_get_row_data (GTK_CLIST(list), row);
list->current_entry = entry;
g_signal_emit (list, query_list_signals[LINE_TOGGLED], 0, entry);
update_booleans (list, row);
}
示例12: gnc_query_list_column_title
static void
gnc_query_list_column_title (GNCQueryList *list, gint column, const gchar *title)
{
GtkWidget *hbox, *label, *arrow;
hbox = gtk_hbox_new(FALSE, 2);
gtk_widget_show(hbox);
gtk_clist_set_column_widget(GTK_CLIST(list), column, hbox);
label = gtk_label_new(title);
gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_ETCHED_IN);
list->title_arrows[column] = arrow;
if (column == 0)
gtk_widget_show(arrow);
gtk_box_pack_end(GTK_BOX(hbox), arrow, FALSE, FALSE, 0);
}
示例13: on_button_uploads_kill_clicked
void
on_button_uploads_kill_clicked(GtkButton *unused_button, gpointer unused_udata)
{
GSList *sl = NULL;
GtkCList *clist;
(void) unused_button;
(void) unused_udata;
clist = GTK_CLIST(gui_main_window_lookup("clist_uploads"));
gtk_clist_freeze(clist);
sl = clist_collect_data(clist, FALSE, NULL);
g_slist_foreach(sl, kill_upload, NULL);
g_slist_free(sl);
gtk_clist_thaw(clist);
}
示例14: _
GtkWidget *create_source_ctree (GtkWidget *scrollwin) {
char *titles[1] = { _("Source") };
GtkWidget *ctree;
/* gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
*/
ctree = gtk_ctree_new_with_titles (1, 0, titles);
gtk_container_add (GTK_CONTAINER (scrollwin), ctree);
gtk_clist_set_selection_mode (GTK_CLIST (ctree), GTK_SELECTION_EXTENDED);
gtk_ctree_set_line_style (GTK_CTREE (ctree), GTK_CTREE_LINES_NONE);
gtk_ctree_set_expander_style (GTK_CTREE (ctree), GTK_CTREE_EXPANDER_TRIANGLE);
gtk_ctree_set_indent (GTK_CTREE (ctree), 10);
fill_source_ctree (ctree);
return ctree;
}
示例15: find_row
static int
find_row (const char *name)
{
GList *tmp_list = GTK_CLIST (settings_clist)->row_list;
int index = 0;
while (tmp_list)
{
GtkCListRow *row = GTK_CLIST_ROW (tmp_list);
if (strcmp (row->data, name) == 0)
return index;
tmp_list = tmp_list->next;
index++;
}
return -1;
}