static void photos_edit_palette_row_constructed (GObject *object) { PhotosEditPaletteRow *self = PHOTOS_EDIT_PALETTE_ROW (object); GtkWidget *grid0; GtkWidget *grid1; GtkWidget *image; GtkWidget *label; GtkWidget *tool_widget; const gchar *icon_name; const gchar *name; gchar *name_markup; G_OBJECT_CLASS (photos_edit_palette_row_parent_class)->constructed (object); self->row_revealer = gtk_revealer_new(); gtk_revealer_set_transition_type (GTK_REVEALER (self->row_revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN); gtk_container_add (GTK_CONTAINER (self), self->row_revealer); grid0 = gtk_grid_new (); gtk_widget_set_margin_bottom (grid0, 6); gtk_widget_set_margin_start (grid0, 18); gtk_widget_set_margin_end (grid0, 18); gtk_widget_set_margin_top (grid0, 6); gtk_orientable_set_orientation (GTK_ORIENTABLE (grid0), GTK_ORIENTATION_VERTICAL); gtk_container_add (GTK_CONTAINER (self->row_revealer), grid0); grid1 = gtk_grid_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (grid1), GTK_ORIENTATION_HORIZONTAL); gtk_grid_set_column_spacing (GTK_GRID (grid1), 12); gtk_container_add (GTK_CONTAINER (grid0), grid1); icon_name = photos_tool_get_icon_name (self->tool); image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON); gtk_container_add (GTK_CONTAINER (grid1), image); name = photos_tool_get_name (self->tool); label = gtk_label_new (NULL); name_markup = g_strdup_printf ("<b>%s</b>", name); gtk_label_set_markup (GTK_LABEL (label), name_markup); gtk_container_add (GTK_CONTAINER (grid1), label); self->details_revealer = gtk_revealer_new (); gtk_revealer_set_transition_type (GTK_REVEALER (self->details_revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN); gtk_container_add (GTK_CONTAINER (grid0), self->details_revealer); tool_widget = photos_tool_get_widget (self->tool); gtk_widget_set_margin_bottom (tool_widget, 12); gtk_widget_set_margin_top (tool_widget, 12); gtk_container_add (GTK_CONTAINER (self->details_revealer), tool_widget); gtk_size_group_add_widget (self->size_group, tool_widget); g_signal_connect_swapped (self->tool, "hide-requested", G_CALLBACK (photos_edit_palette_row_hide_details), self); gtk_widget_show_all (GTK_WIDGET (self)); g_free (name_markup); g_clear_object (&self->size_group); /* We will not need it any more */ }
static int gtkProgressBarMapMethod(Ihandle* ih) { ih->handle = gtk_progress_bar_new(); if (!ih->handle) return IUP_ERROR; /* add to the parent, all GTK controls must call this. */ iupgtkAddToParent(ih); gtk_widget_realize(ih->handle); if (iupStrEqualNoCase(iupAttribGetStr(ih, "ORIENTATION"), "VERTICAL")) { #if GTK_CHECK_VERSION(3, 0, 0) gtk_orientable_set_orientation(GTK_ORIENTABLE(ih->handle), GTK_ORIENTATION_VERTICAL); gtk_progress_bar_set_inverted(GTK_PROGRESS_BAR(ih->handle), TRUE); #else gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(ih->handle), GTK_PROGRESS_BOTTOM_TO_TOP); #endif if (ih->userheight < ih->userwidth) { int tmp = ih->userheight; ih->userheight = ih->userwidth; ih->userwidth = tmp; } } else { #if GTK_CHECK_VERSION(3, 0, 0) gtk_orientable_set_orientation(GTK_ORIENTABLE(ih->handle), GTK_ORIENTATION_HORIZONTAL); #else gtk_progress_bar_set_orientation((GtkProgressBar*)ih->handle, GTK_PROGRESS_LEFT_TO_RIGHT); #endif } if (iupAttribGetBoolean(ih, "MARQUEE")) { #if GTK_CHECK_VERSION(3, 0, 0) gtk_progress_bar_pulse(GTK_PROGRESS_BAR(ih->handle)); #else gtk_progress_set_activity_mode((GtkProgress*)ih->handle, TRUE); #endif ih->data->marquee = 1; ih->data->timer = IupTimer(); IupSetCallback(ih->data->timer, "ACTION_CB", (Icallback)gtkProgressBarTimeCb); IupSetAttribute(ih->data->timer, "TIME", "100"); iupAttribSet(ih->data->timer, "_IUP_PROGRESSBAR", (char*)ih); gtk_progress_bar_set_pulse_step((GtkProgressBar*)ih->handle, 0.02); } else ih->data->marquee = 0; return IUP_NOERROR; }
static int orientation_member(lua_State *L) { lua_box box; luaA_to(L,lua_box,&box,1); dt_lua_orientation_t orientation; if(lua_gettop(L) > 2) { luaA_to(L,dt_lua_orientation_t,&orientation,3); gtk_orientable_set_orientation(GTK_ORIENTABLE(box->widget),orientation); return 0; } orientation = gtk_orientable_get_orientation(GTK_ORIENTABLE(box->widget)); luaA_push(L,dt_lua_orientation_t,&orientation); return 1; }
static void gtk_scale_button_set_orientation_private (GtkScaleButton *button, GtkOrientation orientation) { GtkScaleButtonPrivate *priv = button->priv; if (orientation != priv->orientation) { priv->orientation = orientation; gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->box), orientation); gtk_container_child_set (GTK_CONTAINER (priv->box), button->plus_button, "pack-type", orientation == GTK_ORIENTATION_VERTICAL ? GTK_PACK_START : GTK_PACK_END, NULL); gtk_container_child_set (GTK_CONTAINER (priv->box), button->minus_button, "pack-type", orientation == GTK_ORIENTATION_VERTICAL ? GTK_PACK_END : GTK_PACK_START, NULL); gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->scale), orientation); if (orientation == GTK_ORIENTATION_VERTICAL) { gtk_widget_set_size_request (GTK_WIDGET (priv->scale), -1, SCALE_SIZE); gtk_range_set_inverted (GTK_RANGE (priv->scale), TRUE); } else { gtk_widget_set_size_request (GTK_WIDGET (priv->scale), SCALE_SIZE, -1); gtk_range_set_inverted (GTK_RANGE (priv->scale), FALSE); } /* FIXME: without this, the popup window appears as a square * after changing the orientation */ gtk_window_resize (GTK_WINDOW (priv->dock), 1, 1); g_object_notify (G_OBJECT (button), "orientation"); } }
/* test that g_object_new keeps the provided area */ static void test_iconview_object_new (void) { GtkWidget *view; GtkCellArea *area; area = gtk_cell_area_box_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (area), GTK_ORIENTATION_HORIZONTAL); view = g_object_new (GTK_TYPE_ICON_VIEW, "cell-area", area, NULL); g_assert (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)) == area); g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == gtk_icon_view_get_item_orientation (GTK_ICON_VIEW (view))); g_object_ref_sink (view); g_object_unref (view); }
static void objects_index_init (ObjectsIndex *index, G_GNUC_UNUSED ObjectsIndexClass *klass) { index->priv = g_new0 (ObjectsIndexPrivate, 1); gtk_orientable_set_orientation (GTK_ORIENTABLE (index), GTK_ORIENTATION_VERTICAL); }
static GtkWidget * gui_connection_infobar_new(GtkWidget **out_infobar_close, GtkWidget **out_infobar_reconnect) { GtkWidget *infobar; GtkWidget *msg_label, *content_area, *action_area; msg_label = gtk_label_new(""); gtk_label_set_markup(GTK_LABEL(msg_label), "<b>ERROR: Connection lost</b>"); gtk_widget_show(msg_label); infobar = gtk_info_bar_new(); gtk_info_bar_set_message_type(GTK_INFO_BAR(infobar), GTK_MESSAGE_ERROR); content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(infobar)); gtk_container_add(GTK_CONTAINER(content_area), msg_label); *out_infobar_close = gtk_info_bar_add_button(GTK_INFO_BAR(infobar), "Close", 0); *out_infobar_reconnect = gtk_info_bar_add_button(GTK_INFO_BAR(infobar), "Reconnect", 0); gtk_widget_set_no_show_all(infobar, TRUE); action_area = gtk_info_bar_get_action_area(GTK_INFO_BAR(infobar)); gtk_orientable_set_orientation(GTK_ORIENTABLE(action_area), GTK_ORIENTATION_HORIZONTAL); return infobar; }
static void ide_omni_search_display_init (IdeOmniSearchDisplay *self) { self->providers = g_ptr_array_new_with_free_func (provider_entry_destroy); gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL); }
void create_stat_win() { gwin_stat = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_has_resize_grip(GTK_WINDOW(gwin_stat), FALSE); #if WIN32 set_no_focus(gwin_stat); #endif gtk_container_set_border_width (GTK_CONTAINER (gwin_stat), 0); gtk_widget_realize (gwin_stat); #if UNIX GdkWindow *gdkwin0 = gtk_widget_get_window(gwin_stat); set_no_focus(gwin_stat); #else win32_init_win(gwin_stat); #endif GtkWidget *vbox = gtk_vbox_new (FALSE, 0); gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox), GTK_ORIENTATION_VERTICAL); gtk_container_add (GTK_CONTAINER (gwin_stat), vbox); label_disp = gtk_label_new(NULL); gtk_box_pack_start (GTK_BOX (vbox), label_disp, TRUE, TRUE, 0); gtk_widget_show_all(gwin_stat); timeout_handle = g_timeout_add(3000, timeout_update_stat, NULL); }
static void photos_dropdown_init (PhotosDropdown *self) { GApplication *app; GtkStyleContext *context; PhotosSearchContextState *state; app = g_application_get_default (); state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app)); self->srch_mtch_mngr = g_object_ref (state->srch_mtch_mngr); self->srch_typ_mngr = g_object_ref (state->srch_typ_mngr); self->src_mngr = g_object_ref (state->src_mngr); self->grid = gtk_grid_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (self->grid), GTK_ORIENTATION_HORIZONTAL); gtk_grid_set_row_homogeneous (GTK_GRID (self->grid), TRUE); gtk_container_add (GTK_CONTAINER (self), self->grid); photos_dropdown_add_manager (self, self->src_mngr); photos_dropdown_add_manager (self, self->srch_typ_mngr); photos_dropdown_add_manager (self, self->srch_mtch_mngr); context = gtk_widget_get_style_context (GTK_WIDGET (self)); gtk_style_context_add_class (context, "photos-dropdown"); gtk_widget_hide (GTK_WIDGET(self)); gtk_widget_show_all (GTK_WIDGET (self->grid)); }
static void box_init(lua_State* L) { lua_box box; luaA_to(L,lua_box,&box,-1); gtk_orientable_set_orientation(GTK_ORIENTABLE(box->widget),GTK_ORIENTATION_VERTICAL); gtk_box_set_spacing(GTK_BOX(box->widget), DT_PIXEL_APPLY_DPI(5)); }
static void table_preferences_init (TablePreferences *tpreferences, G_GNUC_UNUSED TablePreferencesClass *klass) { tpreferences->priv = g_new0 (TablePreferencesPrivate, 1); gtk_orientable_set_orientation (GTK_ORIENTABLE (tpreferences), GTK_ORIENTATION_VERTICAL); }
/** * gucharmap_charmap_get_orientation: * @charmap: * * Deprecated: 2.25.0 */ GtkOrientation gucharmap_charmap_get_orientation (GucharmapCharmap *charmap) { g_return_val_if_fail (GUCHARMAP_IS_CHARMAP (charmap), GTK_ORIENTATION_HORIZONTAL); return gtk_orientable_get_orientation (GTK_ORIENTABLE (charmap)); }
static void gdict_speller_init (GdictSpeller *speller) { GdictSpellerPrivate *priv; speller->priv = priv = gdict_speller_get_instance_private (speller); gtk_orientable_set_orientation (GTK_ORIENTABLE (speller), GTK_ORIENTATION_VERTICAL); priv->database = NULL; priv->strategy = NULL; priv->word = NULL; priv->results = -1; priv->context = NULL; priv->store = gtk_list_store_new (MATCH_N_COLUMNS, G_TYPE_INT, /* MatchType */ G_TYPE_STRING, /* db_name */ G_TYPE_STRING /* word */); priv->start_id = 0; priv->end_id = 0; priv->match_id = 0; priv->error_id = 0; }
static void fcitx_ui_widget_init(FcitxUIWidget* self) { gtk_orientable_set_orientation(GTK_ORIENTABLE(self), GTK_ORIENTATION_VERTICAL); self->label = gtk_label_new(_("Cannot load currently used user interface info")); gtk_box_pack_start(GTK_BOX(self), self->label, TRUE, TRUE, 0); }
GtkWidget * file_modify_box_new () { GtkWidget *widget = GTK_WIDGET (g_object_new (file_modify_box_get_type (), NULL)); gtk_orientable_set_orientation (GTK_ORIENTABLE (widget), GTK_ORIENTATION_HORIZONTAL); return widget; }
static void orient_toggled (GtkToggleButton *button, gpointer user_data) { GList *orientables = (GList *) user_data, *ptr; gboolean state = gtk_toggle_button_get_active (button); GtkOrientation orientation; if (state) { orientation = GTK_ORIENTATION_VERTICAL; gtk_button_set_label (GTK_BUTTON (button), "Vertical"); } else { orientation = GTK_ORIENTATION_HORIZONTAL; gtk_button_set_label (GTK_BUTTON (button), "Horizontal"); } for (ptr = orientables; ptr; ptr = ptr->next) { GtkOrientable *orientable = GTK_ORIENTABLE (ptr->data); gtk_orientable_set_orientation (orientable, orientation); } }
void downloadmanager_setup(void) { dm.win = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_type_hint(GTK_WINDOW(dm.win), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_window_set_default_size(GTK_WINDOW(dm.win), 500, 250); gtk_window_set_title(GTK_WINDOW(dm.win), __NAME__" - Download Manager"); g_signal_connect(G_OBJECT(dm.win), "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL); g_signal_connect(G_OBJECT(dm.win), "key-press-event", G_CALLBACK(key_downloadmanager), NULL); dm.toolbar = gtk_toolbar_new(); gtk_orientable_set_orientation(GTK_ORIENTABLE(dm.toolbar), GTK_ORIENTATION_VERTICAL); gtk_toolbar_set_style(GTK_TOOLBAR(dm.toolbar), GTK_TOOLBAR_BOTH_HORIZ); gtk_toolbar_set_show_arrow(GTK_TOOLBAR(dm.toolbar), FALSE); dm.scroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(dm.scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(dm.scroll), dm.toolbar); gtk_container_add(GTK_CONTAINER(dm.win), dm.scroll); }
static void action_task_view_cb (GtkRadioAction *action, GtkRadioAction *current, ETaskShellView *task_shell_view) { ETaskShellContent *task_shell_content; GtkOrientable *orientable; GtkOrientation orientation; task_shell_content = task_shell_view->priv->task_shell_content; orientable = GTK_ORIENTABLE (task_shell_content); switch (gtk_radio_action_get_current_value (action)) { case 0: orientation = GTK_ORIENTATION_VERTICAL; break; case 1: orientation = GTK_ORIENTATION_HORIZONTAL; break; default: g_return_if_reached (); } gtk_orientable_set_orientation (orientable, orientation); }
static void create_toolbar() { browser->toolbar = gtk_toolbar_new(); #ifndef GTK_ORIENTABLE gtk_toolbar_set_orientation(GTK_TOOLBAR (browser->toolbar), GTK_ORIENTATION_HORIZONTAL); #else gtk_orientable_set_orientation(GTK_ORIENTABLE (browser->toolbar), GTK_ORIENTATION_HORIZONTAL); #endif gtk_toolbar_set_style(GTK_TOOLBAR (browser->toolbar), GTK_TOOLBAR_BOTH_HORIZ); GtkToolItem* item; /* the back button */ item = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK); g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_back_cb), (gpointer) browser); gtk_toolbar_insert(GTK_TOOLBAR (browser->toolbar), item, -1); /* The forward button */ item = gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD); g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_forward_cb), (gpointer) browser); gtk_toolbar_insert(GTK_TOOLBAR (browser->toolbar), item, -1); /* The URL entry */ item = gtk_tool_item_new(); gtk_tool_item_set_expand(item, TRUE); browser->uri_entry = gtk_entry_new(); gtk_container_add(GTK_CONTAINER (item), browser->uri_entry); g_signal_connect (G_OBJECT (browser->uri_entry), "activate", G_CALLBACK (activate_uri_entry_cb), (gpointer)browser); gtk_toolbar_insert(GTK_TOOLBAR (browser->toolbar), item, -1); /* The go button */ item = gtk_tool_button_new_from_stock(GTK_STOCK_OK); g_signal_connect_swapped (G_OBJECT (item), "clicked", G_CALLBACK (activate_uri_entry_cb), (gpointer)browser->uri_entry); gtk_toolbar_insert(GTK_TOOLBAR (browser->toolbar), item, -1); }
static void gtk_level_bar_init (GtkLevelBar *self) { GtkStyleContext *context; self->priv = gtk_level_bar_get_instance_private (self); context = gtk_widget_get_style_context (GTK_WIDGET (self)); gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEVEL_BAR); self->priv->cur_value = 0.0; self->priv->min_value = 0.0; self->priv->max_value = 1.0; gtk_level_bar_ensure_offset (self, GTK_LEVEL_BAR_OFFSET_LOW, 0.25); gtk_level_bar_ensure_offset (self, GTK_LEVEL_BAR_OFFSET_HIGH, 0.75); gtk_level_bar_update_level_style_classes (self); self->priv->bar_mode = GTK_LEVEL_BAR_MODE_CONTINUOUS; gtk_level_bar_update_mode_style_classes (self); /* set initial orientation and style classes */ self->priv->orientation = GTK_ORIENTATION_HORIZONTAL; _gtk_orientable_set_style_classes (GTK_ORIENTABLE (self)); self->priv->inverted = FALSE; gtk_widget_set_has_window (GTK_WIDGET (self), FALSE); }
/* * Instance initialization */ static void gnc_item_edit_init (GncItemEdit *item_edit) { /* Set invalid values so that we know when we have been fully initialized */ gtk_orientable_set_orientation (GTK_ORIENTABLE(item_edit), GTK_ORIENTATION_HORIZONTAL); item_edit->sheet = NULL; item_edit->editor = NULL; item_edit->is_popup = FALSE; item_edit->show_popup = FALSE; item_edit->popup_toggle.ebox = NULL; item_edit->popup_toggle.tbutton = NULL; item_edit->popup_toggle.arrow_down = TRUE; item_edit->popup_toggle.signals_connected = FALSE; item_edit->popup_item = NULL; item_edit->popup_get_height = NULL; item_edit->popup_autosize = NULL; item_edit->popup_set_focus = NULL; item_edit->popup_post_show = NULL; item_edit->popup_user_data = NULL; item_edit->style = NULL; gnc_virtual_location_init(&item_edit->virt_loc); }
static void gth_slideshow_preferences_init (GthSlideshowPreferences *self) { self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_SLIDESHOW_PREFERENCES, GthSlideshowPreferencesPrivate); self->priv->builder = NULL; gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL); }
static void photos_error_box_constructed (GObject *object) { PhotosErrorBox *self = PHOTOS_ERROR_BOX (object); G_OBJECT_CLASS (photos_error_box_parent_class)->constructed (object); gtk_widget_set_halign (GTK_WIDGET (self), GTK_ALIGN_CENTER); gtk_widget_set_hexpand (GTK_WIDGET (self), TRUE); gtk_widget_set_valign (GTK_WIDGET (self), GTK_ALIGN_CENTER); gtk_widget_set_vexpand (GTK_WIDGET (self), TRUE); gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL); gtk_grid_set_row_spacing (GTK_GRID (self), 12); self->image = gtk_image_new_from_icon_name ("dialog-error", GTK_ICON_SIZE_INVALID); gtk_image_set_pixel_size (GTK_IMAGE (self->image), 128); gtk_widget_set_halign (self->image, GTK_ALIGN_CENTER); gtk_widget_set_valign (self->image, GTK_ALIGN_CENTER); gtk_container_add (GTK_CONTAINER (self), self->image); self->primary_label = gtk_label_new (NULL); gtk_label_set_use_markup (GTK_LABEL (self->primary_label), TRUE); gtk_widget_set_halign (self->primary_label, GTK_ALIGN_CENTER); gtk_widget_set_valign (self->primary_label, GTK_ALIGN_CENTER); gtk_container_add (GTK_CONTAINER (self), self->primary_label); self->secondary_label = gtk_label_new (NULL); gtk_label_set_use_markup (GTK_LABEL (self->secondary_label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (self->secondary_label), TRUE); gtk_widget_set_halign (self->secondary_label, GTK_ALIGN_CENTER); gtk_widget_set_valign (self->secondary_label, GTK_ALIGN_CENTER); gtk_container_add (GTK_CONTAINER (self), self->secondary_label); gtk_widget_show_all (GTK_WIDGET (self)); }
static void change_orientation (GtkWidget *button, GtkWidget *toolbar) { GtkWidget *grid; GtkOrientation orientation; grid = gtk_widget_get_parent (toolbar); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) orientation = GTK_ORIENTATION_VERTICAL; else orientation = GTK_ORIENTATION_HORIZONTAL; g_object_ref (toolbar); gtk_container_remove (GTK_CONTAINER (grid), toolbar); gtk_orientable_set_orientation (GTK_ORIENTABLE (toolbar), orientation); if (orientation == GTK_ORIENTATION_HORIZONTAL) { gtk_widget_set_hexpand (toolbar, TRUE); gtk_widget_set_vexpand (toolbar, FALSE); gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 2, 1); } else { gtk_widget_set_hexpand (toolbar, FALSE); gtk_widget_set_vexpand (toolbar, TRUE); gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 1, 5); } g_object_unref (toolbar); }
static void caja_x_content_bar_init (CajaXContentBar *bar) { GtkWidget *hbox; bar->priv = CAJA_X_CONTENT_BAR_GET_PRIVATE (bar); hbox = GTK_WIDGET (bar); bar->priv->label = gtk_label_new (NULL); gtk_label_set_ellipsize (GTK_LABEL (bar->priv->label), PANGO_ELLIPSIZE_END); gtk_orientable_set_orientation (GTK_ORIENTABLE (bar), GTK_ORIENTATION_HORIZONTAL); #if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (bar->priv->label), 0.0); #else gtk_misc_set_alignment (GTK_MISC (bar->priv->label), 0.0, 0.5); #endif gtk_box_pack_start (GTK_BOX (bar), bar->priv->label, TRUE, TRUE, 0); bar->priv->button = gtk_button_new (); gtk_box_pack_end (GTK_BOX (hbox), bar->priv->button, FALSE, FALSE, 0); g_signal_connect (bar->priv->button, "clicked", G_CALLBACK (button_clicked_callback), bar); }
int _gtk_paned_get_position2 (GtkPaned *paned) { int pos; GtkWidget *w; GtkRequisition requisition; int size; if (! GTK_WIDGET_VISIBLE (paned)) return 0; pos = gtk_paned_get_position (paned); if (pos == 0) return 0; w = gtk_widget_get_toplevel (GTK_WIDGET (paned)); if (! GTK_WIDGET_TOPLEVEL (w)) return 0; gtk_window_get_size (GTK_WINDOW (w), &(requisition.width), &(requisition.height)); if (gtk_orientable_get_orientation (GTK_ORIENTABLE (paned)) == GTK_ORIENTATION_HORIZONTAL) size = requisition.width; else size = requisition.height; if (size == 0) return 0; return size - pos; }
GtkWidget * create_info_bar_import_music(struct con_win *cwin) { const gchar *dir = g_get_user_special_dir(G_USER_DIRECTORY_MUSIC); GtkWidget *info_bar = gtk_info_bar_new(); GtkWidget *action_area = gtk_info_bar_get_action_area(GTK_INFO_BAR (info_bar)); GtkWidget *content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar)); gtk_orientable_set_orientation(GTK_ORIENTABLE(action_area), GTK_ORIENTATION_HORIZONTAL); //GtkInfoBar has undocumented behavior for GTK_RESPONSE_CANCEL gtk_info_bar_add_button(GTK_INFO_BAR(info_bar), GTK_STOCK_NO, GTK_RESPONSE_CANCEL); gtk_info_bar_add_button(GTK_INFO_BAR(info_bar), GTK_STOCK_YES, GTK_RESPONSE_YES); gchar *content = g_strdup_printf(_("Would you like to import %s to library?"), dir); GtkWidget *label = gtk_label_new(content); gtk_box_pack_start(GTK_BOX(content_area), label, FALSE, FALSE, 0); g_signal_connect(info_bar, "response", G_CALLBACK(info_bar_response_cb), cwin); gtk_widget_show_all(info_bar); g_free(content); return info_bar; }
static void gedit_multi_notebook_init (GeditMultiNotebook *mnb) { GeditMultiNotebookPrivate *priv; mnb->priv = gedit_multi_notebook_get_instance_private (mnb); priv = mnb->priv; priv->removing_notebook = FALSE; gtk_orientable_set_orientation (GTK_ORIENTABLE (mnb), GTK_ORIENTATION_VERTICAL); priv->show_tabs_mode = GEDIT_NOTEBOOK_SHOW_TABS_ALWAYS; priv->show_tabs = TRUE; priv->ui_settings = g_settings_new ("org.gnome.gedit.preferences.ui"); g_settings_bind (priv->ui_settings, GEDIT_SETTINGS_SHOW_TABS_MODE, mnb, "show-tabs-mode", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); priv->active_notebook = gedit_notebook_new (); add_notebook (mnb, priv->active_notebook, TRUE); }
static void vinagre_bookmarks_tree_init (VinagreBookmarksTree *tree) { GtkCellRenderer *cell; GtkWidget *scroll; GtkTreeSelection *selection; GtkTreeStore *model; GtkTreeViewColumn *main_column; tree->priv = G_TYPE_INSTANCE_GET_PRIVATE (tree, VINAGRE_TYPE_BOOKMARKS_TREE, VinagreBookmarksTreePrivate); gtk_orientable_set_orientation (GTK_ORIENTABLE (tree), GTK_ORIENTATION_VERTICAL); /* Create the scrolled window */ scroll = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_ETCHED_OUT); gtk_widget_set_size_request (scroll, 150, 100); gtk_box_pack_start (GTK_BOX (tree), scroll, TRUE, TRUE, 0); /* Create the model */ model = gtk_tree_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING, VINAGRE_TYPE_BOOKMARKS_ENTRY); tree->priv->tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model)); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree->priv->tree), FALSE); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree->priv->tree)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); g_object_unref (model); main_column = gtk_tree_view_column_new (); gtk_tree_view_column_set_clickable (main_column, FALSE); gtk_tree_view_append_column (GTK_TREE_VIEW (tree->priv->tree), main_column); /* Set up the pixbuf column */ cell = gtk_cell_renderer_pixbuf_new (); gtk_tree_view_column_pack_start (main_column, cell, FALSE); gtk_tree_view_column_add_attribute (main_column, cell, "pixbuf", IMAGE_COL); /* Set up the name column */ cell = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start (main_column, cell, TRUE); gtk_tree_view_column_add_attribute (main_column, cell, "text", NAME_COL); g_signal_connect (tree->priv->tree, "row-activated", G_CALLBACK (vinagre_bookmarks_tree_row_activated_cb), tree); vinagre_bookmarks_tree_update_list (tree); gtk_container_add (GTK_CONTAINER(scroll), tree->priv->tree); gtk_widget_show (tree->priv->tree); }