/* Helper function to add contacts label/edit widget pairs to a table, * with respect for structured field edits. */ void contacts_append_to_edit_table (GtkTable *table, GtkWidget *label, GtkWidget *edit, gboolean do_focus) { guint rows, cols; g_object_get (table, "n-rows", &rows, NULL); g_object_get (table, "n-columns", &cols, NULL); gtk_widget_show (label); gtk_widget_show (edit); if (contacts_get_structured_field ( gtk_widget_get_name (GTK_WIDGET (label)), 0)) { GtkWidget *expander = gtk_expander_new (NULL); GtkWidget *viewport = gtk_viewport_new (NULL, NULL); gtk_expander_set_label_widget (GTK_EXPANDER (expander), label); gtk_container_add (GTK_CONTAINER (viewport), edit); gtk_widget_show (viewport); gtk_container_add (GTK_CONTAINER (expander), viewport); gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE); gtk_widget_show (expander); gtk_widget_set_name (expander, gtk_widget_get_name (edit)); /* Highlight selected field */ if (do_focus) { expander = contacts_edit_add_focus_events ( expander, NULL, NULL); } gtk_table_attach (table, GTK_WIDGET (expander), 0, cols, rows, rows+1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); } else { /* Hide the label when the entry is hidden */ g_signal_connect_swapped (G_OBJECT (edit), "hide", G_CALLBACK (gtk_widget_hide), label); /* Highlight selected field */ if (do_focus) { GList *l; GtkWidget *box = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (box), edit); gtk_widget_set_name (box, gtk_widget_get_name (edit)); gtk_widget_show (box); l = g_list_prepend (NULL, box); label = contacts_edit_add_focus_events ( label, NULL, l); g_list_free (l); l = g_list_prepend (NULL, label); edit = contacts_edit_add_focus_events (edit, box, l); g_list_free (l); } gtk_table_attach (table, label, 0, 1, rows, rows+1, GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach (table, edit, 1, cols, rows, rows+1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); } }
/* * Writes the source code needed to create this widget. * You have to output everything necessary to create the widget here, though * there are some convenience functions to help. */ static void gb_file_selection_write_source (GtkWidget * widget, GbWidgetWriteSourceData *data) { gchar *wname, *child_name; if (data->create_widget) { source_add (data, " %s = gtk_file_selection_new (%s);\n", data->wname, source_make_string (GTK_WINDOW (widget)->title, data->use_gettext)); } gb_widget_write_standard_source (widget, data); /* The title is already set above, so we pass NULL to skip it. */ gb_window_write_standard_source (widget, data, NULL, Type, Position, Modal, DefaultWidth, DefaultHeight, Shrink, Grow, AutoShrink, WMName, WMClass, Resizable, DestroyWithParent, Icon); if (GTK_FILE_SELECTION (widget)->fileop_c_dir == NULL) { source_add (data, " gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (%s));\n", data->wname); } /* We output the source code for the buttons here, but we don't want them to be created. We need to remember the dialog's name since data->wname will be overwritten. */ wname = g_strdup (data->wname); source_add (data, "\n"); child_name = (gchar*) gtk_widget_get_name (GTK_FILE_SELECTION (widget)->ok_button); child_name = source_create_valid_identifier (child_name); source_add (data, " %s = GTK_FILE_SELECTION (%s)->ok_button;\n", child_name, wname); g_free (child_name); data->create_widget = FALSE; gb_widget_write_source (GTK_FILE_SELECTION (widget)->ok_button, data); child_name = (gchar*) gtk_widget_get_name (GTK_FILE_SELECTION (widget)->cancel_button); child_name = source_create_valid_identifier (child_name); source_add (data, " %s = GTK_FILE_SELECTION (%s)->cancel_button;\n", child_name, wname); g_free (child_name); data->create_widget = FALSE; gb_widget_write_source (GTK_FILE_SELECTION (widget)->cancel_button, data); g_free (wname); data->write_children = FALSE; }
static gint contacts_widgets_list_sort (GtkWidget *a, GtkWidget *b) { const ContactsField *field1, *field2; field1 = contacts_get_contacts_field (gtk_widget_get_name (a)); field2 = contacts_get_contacts_field (gtk_widget_get_name (b)); return field1->priority - field2->priority; }
/** * Fetch data from the selection of a clist. Returns a GSList containing * the user_data pointers from the selected rows. If allow_null is TRUE, * the returned list may contain NULL pointers. If cfn != NULL, it will * be used to determine whether two entries are equal and drop all duplicate * items from the result list. Using cfn will significantly increase runtime. */ GSList * clist_collect_data(GtkCList *clist, gboolean allow_null, GCompareFunc cfn) { GSList *result_list = NULL; GList *l; GSList *sl; GSList *to_unselect = NULL; g_assert(clist != NULL); /* * Collect the data of the selected rows. */ for (l = clist->selection; l != NULL; l = g_list_next(l)) { gpointer data; gint row; row = GPOINTER_TO_INT(l->data); data = gtk_clist_get_row_data(clist, row); if ((data != NULL) || allow_null) { if (cfn != NULL) { if (g_slist_find_custom(result_list, data, cfn) != NULL) { if (GUI_PROPERTY(gui_debug) >= 3) { const gchar *name = gtk_widget_get_name(GTK_WIDGET(clist)); printf("%s has duplicate data: %p\n", (name != NULL) ? name : "<UNKNOWN>", data); } to_unselect = g_slist_prepend(to_unselect, GINT_TO_POINTER(row)); continue; } } result_list = g_slist_prepend(result_list, data); to_unselect = g_slist_prepend(to_unselect, GINT_TO_POINTER(row)); } else { if (GUI_PROPERTY(gui_debug) >= 3) { const gchar *name = gtk_widget_get_name(GTK_WIDGET(clist)); printf("%s contains NULL data in row %d\n", (name != NULL) ? name : "<UNKNOWN>", row); } } } /* * Unselect the rows from which data has been sucessfully gathered. */ for (sl = to_unselect; sl != NULL; sl = g_slist_next(sl)) gtk_clist_unselect_row(clist, GPOINTER_TO_INT(sl->data), 0); g_slist_free(to_unselect); return result_list; }
void menu_connect(GtkWidget *widget, t_map *map) { if (ft_strsearch("Open scene", (char*)gtk_widget_get_name(widget)) != -1) choose_file(widget, map); else if (ft_strsearch("Quitter", (char*)gtk_widget_get_name(widget)) != -1) exit_rt(map); else if (ft_strsearch("Save picture", (char*)gtk_widget_get_name(widget)) != -1) write_bitmap(map); else if (ft_strsearch("Ouvrir generateur de scene", (char*)gtk_widget_get_name(widget)) != -1) open_generateur_scene(map); }
/* function that closes the current window */ static void window_close(struct window *w) { gtk_widget_destroy(w->notebook); gtk_widget_destroy(w->win); g_free(w); GList *list = gtk_window_list_toplevels(); g_warning("close called %d", g_list_length(list)); g_warning("widget %s", gtk_widget_get_name(g_list_nth_data(list, 0))); g_warning("widget %s", gtk_widget_get_name(g_list_nth_data(list, 1))); if(g_list_length(list) < 2 ) { quit(); } }
/* * Writes the source code needed to create this widget. * You have to output everything necessary to create the widget here, though * there are some convenience functions to help. */ static void gb_input_dialog_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data) { gchar *wname, *child_name; if (data->create_widget) { source_add (data, " %s = gtk_input_dialog_new ();\n", data->wname); } gb_widget_write_standard_source (widget, data); gb_window_write_standard_source (widget, data, Title, Type, Position, Modal, DefaultWidth, DefaultHeight, Shrink, Grow, AutoShrink, IconName, FocusOnMap, Resizable, DestroyWithParent, Icon, Role, TypeHint, SkipTaskbar, SkipPager, Decorated, Gravity, Urgency); /* We output the source code for the buttons here, but we don't want them to be created. We need to remember the dialog's name since data->wname will be overwritten. */ wname = g_strdup (data->wname); source_add (data, "\n"); child_name = (gchar*) gtk_widget_get_name (GTK_INPUT_DIALOG (widget)->save_button); child_name = source_create_valid_identifier (child_name); source_add (data, " %s = GTK_INPUT_DIALOG (%s)->save_button;\n", child_name, wname); g_free (child_name); data->create_widget = FALSE; gb_widget_write_source (GTK_INPUT_DIALOG (widget)->save_button, data); child_name = (gchar*) gtk_widget_get_name (GTK_INPUT_DIALOG (widget)->close_button); child_name = source_create_valid_identifier (child_name); source_add (data, " %s = GTK_INPUT_DIALOG (%s)->close_button;\n", child_name, wname); g_free (child_name); data->create_widget = FALSE; gb_widget_write_source (GTK_INPUT_DIALOG (widget)->close_button, data); g_free (wname); data->write_children = FALSE; }
/** * on_clarity_button_clicked: * * Call handler for the left and right buttons. Cause the images to * be cycled in the direction indicated by the button. * * @widget: button which emitted the signal * @data: any data needed by the function (not required) * */ static void _on_clarity_button_clicked(GtkWidget *widget, gpointer data) { GtkButton *button; const gchar *name; ClarityWidgetPrivate *priv; priv = (ClarityWidgetPrivate *) data; button = GTK_BUTTON(widget); name = gtk_widget_get_name(GTK_WIDGET(button)); gint index = gtk_range_get_value(GTK_RANGE(priv->cdslider)); /* * This looks wrong but the scrolling is reversed, ie. * clicking the right button (--->) makes the animation * cycle towards the left but shows new covers from the * right. */ if (g_str_equal(name, LEFT_BUTTON)) index--; else { index++; } gtk_range_set_value(GTK_RANGE (priv->cdslider), index); }
static GtkWidget* find_widget(GtkWidget* parent, const gchar* name, int depth) { // printf("%*.*c%s\n", depth, depth, ' ', gtk_widget_get_name(parent)); GtkWidget *widget = NULL; if (g_strcasecmp(gtk_widget_get_name(parent), name) == 0) { return parent; } if (GTK_IS_BIN(parent)) { return find_widget(gtk_bin_get_child(GTK_BIN(parent)), name, depth + 1); } if (GTK_IS_CONTAINER(parent)) { GList *list = gtk_container_get_children(GTK_CONTAINER(parent)); for (GList *node = list; node; node = node->next) { widget = find_widget(GTK_WIDGET(node->data), name, depth + 1); if (widget) { break; } } g_list_free(list); } return widget; }
static void gail_window_real_initialize (AtkObject *obj, gpointer data) { GtkWidget *widget = GTK_WIDGET (data); GailWindow *window; /* * A GailWindow can be created for a GtkHandleBox or a GtkWindow */ if (!GTK_IS_WINDOW (widget) && !GTK_IS_HANDLE_BOX (widget)) gail_return_if_fail (FALSE); ATK_OBJECT_CLASS (gail_window_parent_class)->initialize (obj, data); window = GAIL_WINDOW (obj); window->name_change_handler = 0; window->previous_name = g_strdup (gtk_window_get_title (GTK_WINDOW (data))); g_signal_connect (data, "window_state_event", G_CALLBACK (gail_window_state_event_gtk), NULL); g_object_set_data (G_OBJECT (obj), "atk-component-layer", GINT_TO_POINTER (ATK_LAYER_WINDOW)); if (GTK_IS_FILE_SELECTION (widget)) obj->role = ATK_ROLE_FILE_CHOOSER; else if (GTK_IS_COLOR_SELECTION_DIALOG (widget)) obj->role = ATK_ROLE_COLOR_CHOOSER; else if (GTK_IS_FONT_SELECTION_DIALOG (widget)) obj->role = ATK_ROLE_FONT_CHOOSER; else if (GTK_IS_MESSAGE_DIALOG (widget)) obj->role = ATK_ROLE_ALERT; else if (GTK_IS_DIALOG (widget)) obj->role = ATK_ROLE_DIALOG; else { const gchar *name; name = gtk_widget_get_name (widget); if (name && (!strcmp (name, "gtk-tooltip") || !strcmp (name, "gtk-tooltips"))) obj->role = ATK_ROLE_TOOL_TIP; else if (GTK_IS_PLUG (widget)) obj->role = ATK_ROLE_PANEL; else if (GTK_WINDOW (widget)->type == GTK_WINDOW_POPUP) obj->role = ATK_ROLE_WINDOW; else obj->role = ATK_ROLE_FRAME; } /* * Notify that tooltip is showing */ if (obj->role == ATK_ROLE_TOOL_TIP && gtk_widget_get_mapped (widget)) atk_object_notify_state_change (obj, ATK_STATE_SHOWING, 1); }
/*** *** The "configure_event" signal handler. Any processing required when *** the OpenGL-capable drawing area is re-configured should be done here. *** Almost always it will be used to resize the OpenGL viewport when *** the window is resized. ***/ static gboolean configure_event (GtkWidget *widget, GdkEventConfigure *event, gpointer data) { GtkAllocation allocation; GLfloat w; GLfloat h; gtk_widget_get_allocation (widget, &allocation); w = allocation.width; h = allocation.height; g_print ("%s: \"configure_event\"\n", gtk_widget_get_name (widget)); /*** OpenGL BEGIN ***/ if (!gtk_widget_begin_gl (widget)) return FALSE; /*** Fill in the details here. ***/ glViewport (0, 0, w, h); gtk_widget_end_gl (widget, FALSE); /*** OpenGL END ***/ return TRUE; }
G_MODULE_EXPORT gboolean generic_spin_button_handler(GtkWidget *widget, gpointer data) { gfloat tmpf = 0.0; MtxGaugeFace *g = NULL; gint handler = 0; tmpf = (gfloat)gtk_spin_button_get_value((GtkSpinButton *)widget); if (!OBJ_GET((widget),"handler")) { printf("control %s has no handler\n",(gchar *)gtk_widget_get_name(widget)); return FALSE; } handler = (GINT)OBJ_GET((widget),"handler"); if (GTK_IS_WIDGET(gauge)) g = MTX_GAUGE_FACE(gauge); else return FALSE; if (hold_handlers) return TRUE; changed = TRUE; mtx_gauge_face_set_attribute(g,handler,tmpf); if ((handler == UBOUND) || (handler == LBOUND)) update_attributes(); return TRUE; }
void reDrawd(GtkButton *widget,gpointer project) { GtkWidget *layout; layout = gtk_widget_get_parent(widget); GtkWidget *brotherbutton; GtkWidget *windows; GtkWidget *scrollwindows; scrollwindows = gtk_widget_get_parent(layout); windows = gtk_widget_get_parent(scrollwindows); GdkColor color2; color2.red = 10000; color2.green = 50000; color2.blue = 10000; gtk_widget_modify_bg(widget, GTK_STATE_INSENSITIVE, &color2); gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &color2); gtk_widget_set_sensitive(widget,FALSE); gchar *buttonname = gtk_widget_get_name(widget); g_printf("the clicked button is %s\n",buttonname); GList *l = pertnodes; GList *l1; PlannerPertchartNode *clickednode; GList *string = NULL; for(;l;l=l->next) { gchar *pertnodename = mrp_task_get_name(planner_pertchart_node_get_task(l->data)); if(!g_strcmp0(buttonname,pertnodename)) { clickednode = l->data; break; } } GList *brothers = getPertchartNodebrothers(clickednode); for(l1=brothers;l1;l1=l1->next) { gchar *name = mrp_task_get_name(l1->data); brotherbutton = findWidgetByName(buttons,name); GdkColor color; color.red = 50000; color.green = 10000; color.blue = 10000; gtk_widget_modify_bg(brotherbutton, GTK_STATE_INSENSITIVE, &color); gtk_widget_set_sensitive(brotherbutton,FALSE); gtk_button_set_label(brotherbutton, "deleted"); mrp_project_remove_task (project,l1->data); } mrptime lastduration = totalduration(project); displaylastduration(lastduration); }
/*** *** The "motion_notify_event" signal handler. Any processing required when *** the OpenGL-capable drawing area is under drag motion should be done here. ***/ static gboolean motion_notify_event (GtkWidget *widget, GdkEventMotion *event, gpointer data) { g_print ("%s: \"motion_notify_event\": button", gtk_widget_get_name (widget)); /*** Fill in the details here. ***/ if (event->state & GDK_BUTTON1_MASK) { g_print (" 1"); } if (event->state & GDK_BUTTON2_MASK) { g_print (" 2"); } if (event->state & GDK_BUTTON3_MASK) { g_print (" 3"); } g_print ("\n"); return FALSE; }
/*** *** The "button_press_event" signal handler. Any processing required when *** mouse buttons (only left and middle buttons) are pressed on the OpenGL- *** capable drawing area should be done here. ***/ static gboolean button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer data) { g_print ("%s: \"button_press_event\": ", gtk_widget_get_name (widget)); if (event->button == 1) { /*** Fill in the details here. ***/ g_print ("button 1\n"); return TRUE; } if (event->button == 2) { /*** Fill in the details here. ***/ g_print ("button 2\n"); return TRUE; } g_print ("\n"); return FALSE; }
static void on_table_toggled(GtkWidget *widget, gpointer user_data) { if (g_lobby_tab_state == tournament) { tournament_on_table_toggled(widget, user_data); } else if (g_lobby_tab_state == lobby) { (void) user_data; if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { const char* name = gtk_widget_get_name(widget); if(!strcmp(name, "holdem")) { gtk_notebook_set_current_page(s_notebook, VARIANT_HOLDEM); } else if(!strcmp(name, "omaha")) { gtk_notebook_set_current_page(s_notebook, VARIANT_OMAHA); } else if(!strcmp(name, "omaha8")) { gtk_notebook_set_current_page(s_notebook, VARIANT_OMAHA8); } else if(!strcmp(name, "7stud")) { gtk_notebook_set_current_page(s_notebook, VARIANT_7STUD); } set_string("lobby"); set_string("refresh"); set_string(name); flush_io_channel(); } } else { g_critical("g_lobby_tab_state is %i\n", g_lobby_tab_state); } }
/*** *** The "key_press_event" signal handler. Any processing required when key *** presses occur should be done here. ***/ static gboolean key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer data) { g_print ("%s: \"key_press_event\": ", gtk_widget_get_name (widget)); switch (event->keyval) { /*** Fill in the details here. ***/ case GDK_KEY_a: g_print ("a key\n"); toggle_animation (widget); break; case GDK_KEY_Escape: g_print ("Escape key\n"); gtk_main_quit (); break; default: g_print("\n"); return FALSE; } return TRUE; }
/** This function builds a hash table of "interesting" widgets, * i.e. widgets whose name starts with "pref/". This table is * needed to perform name->widget lookups when binding the widgets * to their matching preferences. * * @internal * * @param builder A pointer to builder glade file currently being * added to the dialog. * * @param dialog A pointer to the dialog. The hash table is stored * as a pointer off the dialog so that it can be found in the binding * code. */ static void gnc_prefs_build_widget_table (GtkBuilder *builder, GtkWidget *dialog) { GHashTable *prefs_table; GSList *interesting, *runner; const gchar *name; const gchar *wname; GtkWidget *widget; prefs_table = g_object_get_data(G_OBJECT(dialog), PREFS_WIDGET_HASH); interesting = gtk_builder_get_objects(builder); for (runner = interesting; runner; runner = g_slist_next(runner)) { widget = runner->data; if (GTK_IS_WIDGET(widget)) { wname = gtk_widget_get_name(widget); name = gtk_buildable_get_name(GTK_BUILDABLE(widget)); DEBUG("Widget type is %s and buildable get name is %s", wname, name); if (g_str_has_prefix (name, "pref")) g_hash_table_insert(prefs_table, (gchar *)name, widget); } } g_slist_free(interesting); }
static void update_container_parent_informations (GstyleColorWidget *self) { GtkWidget *parent; GtkWidget *grand_parent; GtkWidget *container; GstylePaletteWidget *palette_widget; g_assert (GSTYLE_IS_COLOR_WIDGET (self)); parent = gtk_widget_get_parent (GTK_WIDGET (self)); if (GTK_IS_LIST_BOX_ROW (parent) || GTK_IS_FLOW_BOX_CHILD (parent)) { grand_parent = gtk_widget_get_parent (GTK_WIDGET (parent)); if (grand_parent != NULL && g_str_has_prefix (gtk_widget_get_name (grand_parent), "palette")) { self->is_in_palette_widget = TRUE; container = gtk_widget_get_ancestor (grand_parent, GSTYLE_TYPE_PALETTE_WIDGET); if (container != NULL && GSTYLE_IS_PALETTE_WIDGET (container)) { palette_widget = GSTYLE_PALETTE_WIDGET (container); self->container_view_mode = gstyle_palette_widget_get_view_mode (GSTYLE_PALETTE_WIDGET (palette_widget)); return; } } } self->is_in_palette_widget = FALSE; }
/* Outputs source to add a child widget to a hbuttonbox. We need to check if the hbuttonbox is a GtkDialog action area, and if it is we use the special gtk_dialog_add_action_widget() function to add it. */ void gb_hbutton_box_write_add_child_source (GtkWidget * parent, const gchar *parent_name, GtkWidget *child, GbWidgetWriteSourceData * data) { if (gb_hbutton_box_is_dialog_action_area (parent) && G_OBJECT_TYPE (child) == GTK_TYPE_BUTTON) { gint response_id; char *response_name, *dialog_name; response_id = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (child), GladeDialogResponseIDKey)); response_name = gb_dialog_response_id_to_string (response_id); dialog_name = (char*) gtk_widget_get_name (parent->parent->parent); dialog_name = source_create_valid_identifier (dialog_name); source_add (data, " gtk_dialog_add_action_widget (GTK_DIALOG (%s), %s, %s);\n", dialog_name, data->wname, response_name); g_free (dialog_name); } else { /* Use the standard gtk_container_add(). */ source_add (data, " gtk_container_add (GTK_CONTAINER (%s), %s);\n", parent_name, data->wname); } }
static void draw_focus (GtkStyle *style, GdkWindow *window, GtkStateType state, GdkRectangle *area, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height) { ThemeMatchData match_data; g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); /* FIXME: memory leak */ LOG ("widget=%s, primitive=focus, state=%s, detail='%s', name='%s'", G_OBJECT_TYPE_NAME (widget), enum_value_to_string (gtk_state_type_get_type (), state), detail, gtk_widget_get_name (widget)); match_data.function = TOKEN_D_FOCUS; match_data.detail = (gchar *)detail; match_data.flags = THEME_MATCH_STATE; match_data.state = state; if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, x, y, width, height)) GTK_STYLE_CLASS (sapwood_style_parent_class)->draw_focus ( style, window, state, area, widget, detail, x, y, width, height); }
void SwapClicked(GtkButton *obj, gpointer data) { const gchar *objname=gtk_widget_get_name(GTK_WIDGET(obj)); int speaker=atoi(objname+4)-1; // get speaker pair number from button name ("swapX") { // swap handles HSTREAM temp=chan[speaker]; chan[speaker]=chan[speaker+1]; chan[speaker+1]=temp; } { // swap text GtkButton *open1,*open2; char bname[10],*temp; sprintf(bname,"open%d",1+speaker); open1=GTK_BUTTON(GetWidget(bname)); sprintf(bname,"open%d",1+speaker+1); open2=GTK_BUTTON(GetWidget(bname)); temp=strdup(gtk_button_get_label(open1)); gtk_button_set_label(open1,gtk_button_get_label(open2)); gtk_button_set_label(open2,temp); free(temp); } // update the channel devices BASS_ChannelFlags(chan[speaker],flags[speaker],BASS_SPEAKER_FRONT); BASS_ChannelFlags(chan[speaker+1],flags[speaker+1],BASS_SPEAKER_FRONT); }
static void insert_smiley_cb(GtkWidget *widget, smiley_callback_data *data) { GtkTextBuffer *entry = NULL; if (data && data->c_window) entry = gtk_text_view_get_buffer(GTK_TEXT_VIEW(data->c_window-> entry)); else { eb_debug(DBG_CORE, "smiley_callback_data has no chat* !\n"); return; } if (entry) { const char *smiley = gtk_widget_get_name(widget); if (smiley) { gtk_text_buffer_insert_at_cursor(entry, smiley, strlen(smiley)); } } if (data->c_window && data->c_window->smiley_window) { gtk_widget_destroy(data->c_window->smiley_window); data->c_window->smiley_window = NULL; } else eb_debug(DBG_CORE, "smiley_window is null * !\n"); }
static void gb_custom_on_widget_realize (GtkWidget *widget, gpointer data) { static GdkPixmap *background_pixmap = NULL; #if 0 g_print ("In gb_custom_on_widget_realize widget:%s (%p)\n", gtk_widget_get_name (widget), widget); #endif /* Create the background pixmap if it hasn't already been created. */ if (background_pixmap == NULL) { background_pixmap = gdk_pixmap_create_from_xpm_d (widget->window, NULL, NULL, custom_bg_xpm); if (!background_pixmap) { g_warning ("Couldn't create background pixmap\n"); /* FIXME: Use a color instead? */ } } if (background_pixmap != NULL) gdk_window_set_back_pixmap (widget->window, background_pixmap, FALSE); }
static gint list_sort_func(GtkListBoxRow *row1, GtkListBoxRow *row2, gpointer user_data){ const char *name1; const char *name2; UserType type1; UserType type2; type1 = (UserType)g_object_get_data(G_OBJECT(row1), "user-type"); type2 = (UserType)g_object_get_data(G_OBJECT(row2), "user-type"); if (type1 != type2) return type1 > type2; name1 = gtk_widget_get_name(GTK_WIDGET(row1)); name2 = gtk_widget_get_name(GTK_WIDGET(row2)); return strcasecmp(name1, name2); }
/* * Gets the properties of the widget. This is used for both displaying the * properties in the property editor, and also for saving the properties. */ static void gb_radio_tool_button_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { GladeFindGroupData find_data; gb_tool_button_get_standard_properties (widget, data, StockButton, Label, Icon, VisibleHorz, VisibleVert, IsImportant); gb_widget_output_bool (data, Active, data->widget_data->flags & GLADE_ACTIVE); /* If we're showing we need to display the list of groups to choose from. We walk the tree of widgets in this component, and if a widget is a radio button, we see if it has a group and if it is already in the list and if not we add it. */ if (data->action == GB_SHOWING) { GladeFindGroupsData find_groups_data; find_groups_data.groups_found = NULL; find_groups_data.group_names = NULL; gb_widget_children_foreach (widget->parent, (GtkCallback) get_radio_button_groups, &find_groups_data); find_groups_data.group_names = g_list_prepend (find_groups_data.group_names, _("New Group")); property_set_combo_strings (Group, find_groups_data.group_names); g_list_free (find_groups_data.groups_found); g_list_free (find_groups_data.group_names); } find_data.group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (widget)); find_data.found_widget = NULL; gb_widget_children_foreach (widget->parent, (GtkCallback) find_radio_group, &find_data); if (find_data.found_widget) { /* If we are saving, we don't output the group if this widget is the first widget in the group. */ if (data->action == GB_SHOWING || find_data.found_widget != widget) { const char *name; name = gtk_widget_get_name (find_data.found_widget); gb_widget_output_combo (data, Group, name); } } else { g_warning ("Radiotoolbutton has no group"); gb_widget_output_combo (data, Group, ""); } }
static void draw_expander (GtkStyle *style, GdkWindow *window, GtkStateType state, GdkRectangle *area, GtkWidget *widget, const gchar *detail, gint center_x, gint center_y, GtkExpanderStyle expander_style) { ThemeMatchData match_data; gint expander_size = 10; g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); /* FIXME: memory leak */ LOG ("widget=%s, primitive=expander, state=%s, detail='%s', name='%s'", G_OBJECT_TYPE_NAME (widget), enum_value_to_string (gtk_state_type_get_type (), state), detail, gtk_widget_get_name (widget)); /* Reusing the arrow theming here as it's flexible enough (almost, we do lose * the intermediate states.) It also allows us to use existing gtkrc. * XXX Might want to introduce proper keywords for expanders some day. */ if (widget) gtk_widget_style_get (widget, "expander-size", &expander_size, NULL); match_data.function = TOKEN_D_ARROW; match_data.detail = (gchar *)detail; match_data.flags = THEME_MATCH_STATE | THEME_MATCH_ARROW_DIRECTION; match_data.state = state; switch (expander_style) { case GTK_EXPANDER_COLLAPSED: case GTK_EXPANDER_SEMI_COLLAPSED: match_data.arrow_direction = GTK_ARROW_RIGHT; break; case GTK_EXPANDER_EXPANDED: case GTK_EXPANDER_SEMI_EXPANDED: match_data.arrow_direction = GTK_ARROW_DOWN; break; default: g_return_if_reached (); } if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, center_x - expander_size/2, center_y - expander_size/2, expander_size, expander_size)) GTK_STYLE_CLASS (sapwood_style_parent_class)->draw_expander ( style, window, state, area, widget, detail, center_x, center_y, expander_style); }
/* Obtain a string identifying this window. If the window has a name, we use that. Otherwise we fall back on the class name. */ static const char * get_window_id (GtkWidget *wb) { const gchar *name = gtk_widget_get_name (wb); if (NULL == name || 0 == strcmp ("", name)) name = G_OBJECT_TYPE_NAME (wb); return name; }
static gint contacts_widgets_list_find (GtkWidget *a, guint *b) { const ContactsField *field1; field1 = contacts_get_contacts_field (gtk_widget_get_name (a)); return field1->priority - *b; }
static gboolean cb_mass_change (GtkWidget *widget, gpointer data) { gui_world *world = (gui_world *)data; world->mass = atoi(gtk_widget_get_name(widget)); return FALSE; }