static GtkWidget* new_testrgb_window (GdkPixbuf *pixbuf, gchar *title) { GtkWidget *window; GtkWidget *vbox; GtkWidget *temp_box; GtkWidget *button; GtkWidget *drawing_area; gint w, h; w = gdk_pixbuf_get_width (pixbuf); h = gdk_pixbuf_get_height (pixbuf); window = gtk_widget_new (gtk_window_get_type (), "GtkObject::user_data", NULL, "GtkWindow::type", GTK_WINDOW_TOPLEVEL, "GtkWindow::title", "testrgb", "GtkWindow::allow_shrink", TRUE, NULL); gtk_signal_connect (GTK_OBJECT (window), "destroy", (GtkSignalFunc) quit_func, NULL); vbox = gtk_vbox_new (FALSE, 0); if (title) gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new (title), TRUE, TRUE, 0); drawing_area = gtk_drawing_area_new (); temp_box = gtk_hbox_new (FALSE, 0); gtk_drawing_area_size (GTK_DRAWING_AREA(drawing_area), w, h); gtk_box_pack_start (GTK_BOX (temp_box), drawing_area, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), temp_box, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT(drawing_area), "expose_event", GTK_SIGNAL_FUNC(expose_func), NULL); gtk_signal_connect (GTK_OBJECT(drawing_area), "configure_event", GTK_SIGNAL_FUNC (config_func), NULL); gtk_object_set_data (GTK_OBJECT(drawing_area), "pixbuf", pixbuf); gtk_widget_show (drawing_area); button = gtk_button_new_with_label ("Quit"); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_signal_connect_object (GTK_OBJECT (button), "clicked", (GtkSignalFunc) gtk_widget_destroy, GTK_OBJECT (window)); gtk_widget_show (button); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show_all (vbox); gtk_widget_show (window); return window; }
static int get_widget_params(lua_State *L) { struct dt_lua_widget_type_t *widget_type = lua_touserdata(L, lua_upvalueindex(1)); if(G_TYPE_IS_ABSTRACT(widget_type->gtk_type)){ luaL_error(L,"Trying to create a widget of an abstract type : %s\n",widget_type->name); } lua_widget widget= malloc(widget_type->alloc_size); widget->widget = gtk_widget_new(widget_type->gtk_type,NULL); gtk_widget_show(widget->widget);// widgets are invisible by default g_object_ref_sink(widget->widget); widget->type = widget_type; luaA_push_type(L,widget_type->associated_type,&widget); dt_lua_type_gpointer_alias_type(L,widget_type->associated_type,widget,widget->widget); init_widget_sub(L,widget_type); luaL_getmetafield(L,-1,"__gtk_signals"); lua_pushnil(L); /* first key */ while(lua_next(L, -2) != 0) { g_signal_connect(widget->widget, lua_tostring(L,-2), G_CALLBACK(lua_touserdata(L,-1)), widget); lua_pop(L,1); } lua_pop(L,1); return 1; }
GtkWidget *e_create_image_widget(gchar *name, gchar *string1, gchar *string2, gint int1, gint int2) { GtkWidget *alignment = NULL; GtkWidget *w; if (string1) { w = e_icon_factory_get_image (string1, E_ICON_SIZE_DIALOG); gtk_misc_set_alignment (GTK_MISC (w), 0.5, 0.5); alignment = gtk_widget_new(gtk_alignment_get_type(), "child", w, "xalign", (double) 0, "yalign", (double) 0, "xscale", (double) 0, "yscale", (double) 0, NULL); gtk_widget_show_all (alignment); } return alignment; }
static GtkWidget* new_testrgb_window (GdkPixbuf *pixbuf, gchar *title) { GtkWidget *window; GtkWidget *vbox; GtkWidget *temp_box; GtkWidget *button; GtkWidget *drawing_area; gint w, h; g_return_val_if_fail (pixbuf != NULL, NULL); w = gdk_pixbuf_get_width (pixbuf); h = gdk_pixbuf_get_height (pixbuf); window = gtk_widget_new (gtk_window_get_type (), "GtkObject::user_data", NULL, "GtkWindow::type", GTK_WINDOW_TOPLEVEL, "GtkWindow::title", title ? title : "testrgb", "GtkWindow::allow_shrink", TRUE, NULL); g_signal_connect (window, "destroy", G_CALLBACK (quit_func), NULL); vbox = gtk_vbox_new (FALSE, 0); if (title) gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new (title), TRUE, TRUE, 0); drawing_area = gtk_drawing_area_new (); temp_box = gtk_hbox_new (FALSE, 0); gtk_widget_set_size_request (GTK_WIDGET (drawing_area), w, h); gtk_box_pack_start (GTK_BOX (temp_box), drawing_area, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), temp_box, FALSE, FALSE, 0); g_signal_connect (drawing_area, "expose_event", G_CALLBACK (expose_func), NULL); g_signal_connect (drawing_area, "configure_event", G_CALLBACK (config_func), NULL); g_object_set_data (G_OBJECT (drawing_area), "pixbuf", pixbuf); gtk_widget_show (drawing_area); button = gtk_button_new_with_label ("Quit"); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window); gtk_widget_show (button); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show_all (vbox); gtk_widget_show (window); return drawing_area; }
CajaDesktopWindow * caja_desktop_window_new (CajaApplication *application, GdkScreen *screen) { CajaDesktopWindow *window; int width_request, height_request; width_request = gdk_screen_get_width (screen); height_request = gdk_screen_get_height (screen); window = CAJA_DESKTOP_WINDOW (gtk_widget_new (caja_desktop_window_get_type(), "app", application, "width_request", width_request, "height_request", height_request, "screen", screen, NULL)); /* Special sawmill setting*/ gtk_window_set_wmclass (GTK_WINDOW (window), "desktop_window", "Caja"); g_signal_connect (window, "delete_event", G_CALLBACK (caja_desktop_window_delete_event), NULL); /* Point window at the desktop folder. * Note that caja_desktop_window_init is too early to do this. */ caja_desktop_window_update_directory (window); return window; }
GtkWidget* bst_choice_menu_createv (const gchar *menu_path, BstChoice *first_choice, ...) { BstChoice *choice; GtkWidget *menu; va_list args; va_start (args, first_choice); menu = g_object_connect (gtk_widget_new (GTK_TYPE_MENU, NULL), "signal::selection-done", check_modal_quit, NULL, NULL); gtk_menu_set_accel_path (GTK_MENU (menu), menu_path); gtk_widget_ref (menu); gtk_object_sink (GTK_OBJECT (menu)); choice = first_choice; while (choice) { bst_choice_menu_add_choice_and_free (menu, choice); choice = va_arg (args, BstChoice*); } va_end (args); return menu; }
/** * g_paste_settings_ui_stack_new: * * Create a new instance of #GPasteSettingsUiStack * * Returns: a newly allocated #GPasteSettingsUiStack * free it with g_object_unref */ G_PASTE_VISIBLE GPasteSettingsUiStack * g_paste_settings_ui_stack_new (void) { return G_PASTE_SETTINGS_UI_STACK (gtk_widget_new (G_PASTE_TYPE_SETTINGS_UI_STACK, "margin", 12, "homogeneous", TRUE, NULL)); }
static GtkWidget * thunar_location_bar_install_widget (ThunarLocationBar *bar, GType type) { GtkWidget *installedWidget, *child; /* check if the the right type is already installed */ if ((child = gtk_bin_get_child (GTK_BIN (bar))) && G_TYPE_CHECK_INSTANCE_TYPE (child, type)) return child; if (type == THUNAR_TYPE_LOCATION_ENTRY) { if (bar->locationEntry == NULL) { bar->locationEntry = gtk_widget_new (THUNAR_TYPE_LOCATION_ENTRY, "current-directory", NULL, NULL); g_object_ref (bar->locationEntry); g_signal_connect_swapped (bar->locationEntry, "reload-requested", G_CALLBACK (thunar_location_bar_reload_requested), bar); g_signal_connect_swapped (bar->locationEntry, "change-directory", G_CALLBACK (thunar_navigator_change_directory), THUNAR_NAVIGATOR (bar)); g_signal_connect_swapped (bar->locationEntry, "open-new-tab", G_CALLBACK (thunar_navigator_open_new_tab), THUNAR_NAVIGATOR (bar)); } installedWidget = bar->locationEntry; } else { if (bar->locationButtons == NULL) { bar->locationButtons = gtk_widget_new (THUNAR_TYPE_LOCATION_BUTTONS, "current-directory", NULL, NULL); g_object_ref (bar->locationButtons); g_signal_connect_swapped (bar->locationButtons, "entry-requested", G_CALLBACK (thunar_location_bar_request_entry), bar); g_signal_connect_swapped (bar->locationButtons, "change-directory", G_CALLBACK (thunar_navigator_change_directory), THUNAR_NAVIGATOR (bar)); g_signal_connect_swapped (bar->locationButtons, "open-new-tab", G_CALLBACK (thunar_navigator_open_new_tab), THUNAR_NAVIGATOR (bar)); } installedWidget = bar->locationButtons; } thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (installedWidget), bar->current_directory); if ((child = gtk_bin_get_child (GTK_BIN (bar)))) gtk_container_remove (GTK_CONTAINER (bar), child); gtk_container_add (GTK_CONTAINER (bar), installedWidget); gtk_widget_show (installedWidget); return installedWidget; }
GtkWidget* gtk_dir_tree_new (void) { GtkWidget *widget; widget = gtk_widget_new (gtk_dir_tree_get_type(), NULL); return widget; }
GtkWidget * aw_popup_dialog_new (GtkWindow *parent, const char *title) { return gtk_widget_new (AW_TYPE_POPUP_DIALOG, "transient-for", parent, "title", title, "modal", TRUE, "destroy-with-parent", TRUE, "has-separator", FALSE, NULL); }
GtkWidget* gtk_plot_flux_new () { GtkWidget *widget; widget = gtk_widget_new (gtk_plot_flux_get_type (), NULL); return (widget); }
GtkWidget * athena_location_bar_new (void) { GtkWidget *bar; bar = gtk_widget_new (ATHENA_TYPE_LOCATION_BAR, NULL); return bar; }
GtkWidget * nemo_location_bar_new (void) { GtkWidget *bar; bar = gtk_widget_new (NEMO_TYPE_LOCATION_BAR, NULL); return bar; }
GtkWidget* eel_background_box_new (void) { EelBackgroundBox *background_box; background_box = EEL_BACKGROUND_BOX (gtk_widget_new (eel_background_box_get_type (), NULL)); return GTK_WIDGET (background_box); }
void bst_choice_menu_add_choice_and_free (GtkWidget *menu, BstChoice *choice) { guint choice_type, choice_flags; GtkWidget *item; g_return_if_fail (GTK_IS_MENU (menu)); g_return_if_fail (choice != NULL); choice_type = choice->type_and_flags & BST_CHOICE_TYPE_MASK; choice_flags = choice->type_and_flags & BST_CHOICE_FLAG_MASK; item = gtk_widget_new (GTK_TYPE_IMAGE_MENU_ITEM, "visible", TRUE, "sensitive", !((choice_flags & BST_CHOICE_FLAG_INSENSITIVE) || (choice_type != BST_CHOICE_TYPE_ITEM && choice_type != BST_CHOICE_TYPE_SUBMENU)), "parent", menu, "user_data", choice->p_id, NULL); if (choice_type == BST_CHOICE_TYPE_SUBMENU) gxk_menu_attach_as_submenu (GTK_MENU (choice->p_id), GTK_MENU_ITEM (item)); else menu_item_add_activator (item, menu_choice_activate); if (choice->name) { GtkWidget *any; if (choice->icon_stock_id) gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), gxk_stock_image (choice->icon_stock_id, GXK_ICON_SIZE_MENU)); any = gtk_widget_new (GTK_TYPE_ACCEL_LABEL, "visible", TRUE, "label", choice->name, "parent", item, "accel_widget", item, "xalign", 0.0, NULL); if (choice_type == BST_CHOICE_TYPE_TITLE) gxk_widget_modify_as_title (any); } free_choice (choice); }
static GtkLabel * g_paste_settings_ui_panel_add_label (GPasteSettingsUiPanel *self, const gchar *label) { GtkLabel *button_label = (GtkLabel *) gtk_widget_new (GTK_TYPE_LABEL, "label", label, "xalign", 0.0, NULL); gtk_grid_attach (GTK_GRID (self), GTK_WIDGET (button_label), 0, self->priv->current_line++, 1, 1); return button_label; }
GtkWidget * nemo_entry_new_with_max_length (guint16 max) { GtkWidget *widget; widget = gtk_widget_new (NEMO_TYPE_ENTRY, NULL); gtk_entry_set_max_length (GTK_ENTRY (widget), max); return widget; }
GtkWidget * athena_entry_new_with_max_length (guint16 max) { GtkWidget *widget; widget = gtk_widget_new (ATHENA_TYPE_ENTRY, NULL); gtk_entry_set_max_length (GTK_ENTRY (widget), max); return widget; }
GtkWidget * nautilus_entry_new_with_max_length (guint16 max) { GtkWidget *widget; widget = gtk_widget_new (NAUTILUS_TYPE_ENTRY, NULL); gtk_entry_set_max_length (GTK_ENTRY (widget), max); return widget; }
GtkWidget* anjuta_msgman_new (GtkWidget *popup_menu) { GtkWidget *msgman = NULL; msgman = gtk_widget_new (ANJUTA_TYPE_MSGMAN, "show-tabs", FALSE, NULL); if (msgman) { ANJUTA_MSGMAN (msgman)->priv->popup_menu = popup_menu; } return msgman; }
/** * eel_wrap_table_new: * */ GtkWidget* eel_wrap_table_new (gboolean homogeneous) { EelWrapTable *wrap_table; wrap_table = EEL_WRAP_TABLE (gtk_widget_new (eel_wrap_table_get_type (), NULL)); eel_wrap_table_set_homogeneous (wrap_table, homogeneous); return GTK_WIDGET (wrap_table); }
/** * gtk_plot_polar_new: * @drawable: * * * * Return value: */ GtkWidget* gtk_plot_polar_new (GdkDrawable *drawable) { GtkWidget* plot; plot = gtk_widget_new (gtk_plot_polar_get_type (), NULL); gtk_plot_polar_construct(GTK_PLOT_POLAR(plot), drawable); return plot; }
/** * gtk_plot_polar_new_with_size: * @drawable: * @width: * @height: * * * * Return value: */ GtkWidget* gtk_plot_polar_new_with_size (GdkDrawable *drawable, gdouble width, gdouble height) { GtkWidget *plot; plot = gtk_widget_new (gtk_plot_polar_get_type (), NULL); gtk_plot_polar_construct_with_size(GTK_PLOT_POLAR(plot), drawable, width, height); return(plot); }
GtkWidget* cvImageWidgetNew (int flags) { CvImageWidget *image_widget; image_widget = CV_IMAGE_WIDGET( gtk_widget_new (cvImageWidget_get_type (), NULL) ); image_widget->original_image = 0; image_widget->scaled_image = 0; image_widget->flags = flags | CV_WINDOW_NO_IMAGE; return GTK_WIDGET (image_widget); }
/** * gwy_data_view_new: * @data: A #GwyContainer containing the data to display. * * Creates a new data-displaying widget for @data. * * A newly created #GwyDataView doesn't display anything. You have to add * some layers to it, at least a base layer with * gwy_data_view_set_base_layer(), and possibly others with * gwy_data_view_set_alpha_layer() and gwy_data_view_set_top_layer(). * * The top layer is special. It must be a vector layer and can receive * mouse and keyboard events. * * The base layer it also special. It must be always present, and must not be * transparent or vector. * * Returns: A newly created data view as a #GtkWidget. **/ GtkWidget* gwy_data_view_new(GwyContainer *data) { GtkWidget *data_view; gwy_debug(" "); g_return_val_if_fail(GWY_IS_CONTAINER(data), NULL); data_view = gtk_widget_new(GWY_TYPE_DATA_VIEW, NULL); g_object_ref(data); GWY_DATA_VIEW(data_view)->data = data; return data_view; }
/** * g_paste_settings_ui_stack_new: * * Create a new instance of #GPasteSettingsUiStack * * Returns: (nullable): a newly allocated #GPasteSettingsUiStack * free it with g_object_unref */ G_PASTE_VISIBLE GPasteSettingsUiStack * g_paste_settings_ui_stack_new (void) { GPasteSettingsUiStack *self = G_PASTE_SETTINGS_UI_STACK (gtk_widget_new (G_PASTE_TYPE_SETTINGS_UI_STACK, "margin", 12, "homogeneous", TRUE, NULL)); GPasteSettingsUiStackPrivate *priv = g_paste_settings_ui_stack_get_instance_private (self); if (g_paste_settings_ui_check_connection_error (priv->init_error)) { g_object_unref (self); return NULL; } return self; }
/** * g_paste_ui_header_new: * @topwin: the main #GtkWindow * @client: a #GPasteClient instance * * Create a new instance of #GPasteUiHeader * * Returns: a newly allocated #GPasteUiHeader * free it with g_object_unref */ G_PASTE_VISIBLE GtkWidget * g_paste_ui_header_new (GtkWindow *topwin, GPasteClient *client) { g_return_val_if_fail (GTK_IS_WINDOW (topwin), NULL); g_return_val_if_fail (G_PASTE_IS_CLIENT (client), NULL); GtkWidget *self = gtk_widget_new (G_PASTE_TYPE_UI_HEADER, NULL); GtkHeaderBar *bar = GTK_HEADER_BAR (self); gtk_header_bar_pack_start (bar, g_paste_ui_switch_new (topwin, client)); gtk_header_bar_pack_end (bar, g_paste_ui_about_new (gtk_window_get_application (topwin))); gtk_header_bar_pack_end (bar, g_paste_ui_empty_new (topwin, client)); return self; }
static void widget_property_tests (gconstpointer test_data) { GType wtype = (GType) test_data; /* create widget */ GtkWidget *widget = gtk_widget_new (wtype, NULL); g_object_ref_sink (widget); widget_fixups (widget); /* test property values */ widget_test_properties (widget, +2); /* test default_value */ widget_test_properties (widget, 0); /* test minimum */ widget_test_properties (widget, 0.5); /* test medium */ widget_test_properties (widget, 1); /* test maximum */ widget_test_properties (widget, -1); /* test random value */ /* cleanup */ gtk_widget_destroy (widget); g_object_unref (widget); }
/* nautilus_keep_last_vertical_box_new: * * Create a new vertical box that clips off items from the end that don't * fit, except the last item, which is always kept. When packing this widget * into another vbox, use TRUE for expand and TRUE for fill or this class's * special clipping magic won't work because this widget's allocation might * be larger than the available space. * * @spacing: Vertical space between items. * * Return value: A new NautilusKeepLastVerticalBox */ GtkWidget * nautilus_keep_last_vertical_box_new (gint spacing) { NautilusKeepLastVerticalBox *box; box = NAUTILUS_KEEP_LAST_VERTICAL_BOX (gtk_widget_new (nautilus_keep_last_vertical_box_get_type (), NULL)); gtk_box_set_spacing (GTK_BOX (box), spacing); /* If homogeneous is TRUE and there are too many items to fit * naturally, they will be squashed together to fit in the space. * We want the ones that don't fit to be not shown at all, so * we set homogeneous to FALSE. */ gtk_box_set_homogeneous (GTK_BOX (box), FALSE); return GTK_WIDGET (box); }
GtkWidget * add_submenu (GtkWidget * menu_bar, gchar * label_text, GtkWidget * menu) { GtkWidget *menu_item; GtkWidget *label; menu_item = gtk_menu_item_new (); label = gtk_widget_new (GTK_TYPE_LABEL, "GtkWidget::visible", TRUE, "GtkWidget::parent", menu_item, "GtkMisc::xalign", 0.0, NULL); gtk_label_parse_uline (GTK_LABEL (label), label_text); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), menu); gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), menu_item); gtk_widget_show (menu_item); return menu_item; }