static void create_gui(MathDisplay *display) { GtkWidget *info_view, *info_box, *main_box; PangoFontDescription *font_desc; int i; GtkStyle *style; main_box = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(display), main_box); g_signal_connect(display, "key-press-event", G_CALLBACK(key_press_cb), display); display->priv->text_view = gtk_text_view_new_with_buffer(GTK_TEXT_BUFFER(display->priv->equation)); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(display->priv->text_view), GTK_WRAP_WORD); gtk_text_view_set_accepts_tab(GTK_TEXT_VIEW(display->priv->text_view), FALSE); gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(display->priv->text_view), 8); gtk_text_view_set_pixels_below_lines(GTK_TEXT_VIEW(display->priv->text_view), 2); /* TEMP: Disabled for now as GTK+ doesn't properly render a right aligned right margin, see bug #482688 */ /*gtk_text_view_set_right_margin(GTK_TEXT_VIEW(display->priv->text_view), 6);*/ gtk_text_view_set_justification(GTK_TEXT_VIEW(display->priv->text_view), GTK_JUSTIFY_RIGHT); gtk_widget_ensure_style(display->priv->text_view); font_desc = pango_font_description_copy(gtk_widget_get_style(display->priv->text_view)->font_desc); pango_font_description_set_size(font_desc, 16 * PANGO_SCALE); gtk_widget_modify_font(display->priv->text_view, font_desc); pango_font_description_free(font_desc); gtk_widget_set_name(display->priv->text_view, "displayitem"); atk_object_set_role(gtk_widget_get_accessible(display->priv->text_view), ATK_ROLE_EDITBAR); //FIXME:<property name="AtkObject::accessible-description" translatable="yes" comments="Accessible description for the area in which results are displayed">Result Region</property> g_signal_connect(display->priv->text_view, "key-press-event", G_CALLBACK(display_key_press_cb), display); gtk_box_pack_start(GTK_BOX(main_box), display->priv->text_view, TRUE, TRUE, 0); info_box = gtk_hbox_new(FALSE, 6); gtk_box_pack_start(GTK_BOX(main_box), info_box, FALSE, TRUE, 0); info_view = gtk_text_view_new(); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(info_view), GTK_WRAP_WORD); gtk_widget_set_can_focus(info_view, TRUE); // FIXME: This should be FALSE but it locks the cursor inside the main view for some reason gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(info_view), FALSE); // FIXME: Just here so when incorrectly gets focus doesn't look editable gtk_text_view_set_editable(GTK_TEXT_VIEW(info_view), FALSE); gtk_text_view_set_justification(GTK_TEXT_VIEW(info_view), GTK_JUSTIFY_RIGHT); /* TEMP: Disabled for now as GTK+ doesn't properly render a right aligned right margin, see bug #482688 */ /*gtk_text_view_set_right_margin(GTK_TEXT_VIEW(info_view), 6);*/ gtk_box_pack_start(GTK_BOX(info_box), info_view, TRUE, TRUE, 0); display->priv->info_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(info_view)); display->priv->spinner = gtk_spinner_new(); gtk_box_pack_end(GTK_BOX(info_box), display->priv->spinner, FALSE, FALSE, 0); style = gtk_widget_get_style(info_view); for (i = 0; i < 5; i++) { gtk_widget_modify_bg(GTK_WIDGET(display), i, &style->base[i]); } gtk_widget_show(info_box); gtk_widget_show(info_view); gtk_widget_show(display->priv->text_view); gtk_widget_show(main_box); g_signal_connect(display->priv->equation, "notify::status", G_CALLBACK(status_changed_cb), display); status_changed_cb(display->priv->equation, NULL, display); }
static GtkWidget * create_window (int confirm_mode) { GtkWidget *w; GtkWidget *win, *box, *ebox; GtkWidget *sbox, *bbox; GtkAccelGroup *acc; /* fixme: check the grabbing code against the one we used with the old gpg-agent */ win = gtk_window_new (GTK_WINDOW_TOPLEVEL); acc = gtk_accel_group_new (); gtk_signal_connect (GTK_OBJECT (win), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL); #if 0 gtk_signal_connect (GTK_OBJECT(win), "destroy", gtk_main_quit, NULL); #endif gtk_signal_connect (GTK_OBJECT(win), "size-request", constrain_size, NULL); if (!confirm_mode) { gtk_signal_connect (GTK_OBJECT(win), pinentry->grab ? "map-event" : "focus-in-event", grab_keyboard, NULL); gtk_signal_connect (GTK_OBJECT(win), pinentry->grab ? "unmap-event" : "focus-out-event", ungrab_keyboard, NULL); } gtk_accel_group_attach(acc, GTK_OBJECT(win)); box = gtk_vbox_new (FALSE, 5); gtk_container_add (GTK_CONTAINER(win), box); gtk_container_set_border_width (GTK_CONTAINER (box), 5); if (pinentry->description) { w = create_utf8_label (pinentry->description); gtk_box_pack_start (GTK_BOX(box), w, TRUE, FALSE, 0); } if (pinentry->error && !confirm_mode) { GtkStyle *style; GdkColormap *cmap; GdkColor color[1] = {{0, 0xffff, 0, 0}}; gboolean success[1]; w = create_utf8_label (pinentry->error); gtk_box_pack_start (GTK_BOX(box), w, TRUE, FALSE, 5); /* fixme: Do we need to release something, or is there a more easy way to set a text color? */ gtk_widget_realize (win); cmap = gdk_window_get_colormap (win->window); assert (cmap); gdk_colormap_alloc_colors (cmap, color, 1, FALSE, TRUE, success); if (success[0]) { gtk_widget_ensure_style(w); style = gtk_style_copy(gtk_widget_get_style(w)); style->fg[GTK_STATE_NORMAL] = color[0]; gtk_widget_set_style(w, style); } } ebox = gtk_hbox_new (FALSE, 5); gtk_box_pack_start (GTK_BOX(box), ebox, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (ebox), 5); if (!confirm_mode) { if (pinentry->prompt) { w = create_utf8_label (pinentry->prompt); gtk_box_pack_start (GTK_BOX(ebox), w, FALSE, FALSE, 0); } entry = gtk_secure_entry_new (); gtk_signal_connect (GTK_OBJECT (entry), "activate", GTK_SIGNAL_FUNC (enter_callback), entry); gtk_box_pack_start (GTK_BOX(ebox), entry, TRUE, TRUE, 0); gtk_secure_entry_set_visibility (GTK_SECURE_ENTRY(entry), FALSE); gtk_signal_connect_after (GTK_OBJECT(entry), "button_press_event", unselect, NULL); gtk_widget_grab_focus (entry); gtk_widget_show (entry); if (pinentry->enhanced) { sbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(box), sbox, FALSE, FALSE, 0); w = gtk_label_new ("Forget secret after"); gtk_box_pack_start(GTK_BOX(sbox), w, FALSE, FALSE, 0); gtk_widget_show(w); time_out = gtk_spin_button_new (GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, HUGE_VAL, 1, 60, 60)),2,0); gtk_box_pack_start (GTK_BOX(sbox), time_out, FALSE, FALSE, 0); gtk_widget_show (time_out); w = gtk_label_new ("seconds"); gtk_box_pack_start (GTK_BOX(sbox), w, FALSE, FALSE, 0); gtk_widget_show (w); gtk_widget_show (sbox); insure = gtk_check_button_new_with_label ("ask before giving out secret"); gtk_box_pack_start (GTK_BOX(box), insure, FALSE, FALSE, 0); gtk_widget_show (insure); } } bbox = gtk_hbutton_box_new(); gtk_box_pack_start (GTK_BOX(box), bbox, TRUE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (bbox), 5); w = gtk_button_new_with_label (pinentry->ok ? pinentry->ok : "OK"); gtk_container_add (GTK_CONTAINER(bbox), w); if (!confirm_mode) { gtk_signal_connect (GTK_OBJECT(w), "clicked", button_clicked, "ok"); GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT); gtk_widget_grab_default (w); gtk_signal_connect_object (GTK_OBJECT (entry), "focus_in_event", GTK_SIGNAL_FUNC (gtk_widget_grab_default), GTK_OBJECT (w)); } else { gtk_signal_connect (GTK_OBJECT(w), "clicked", confirm_button_clicked, "ok"); GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT); } gtk_widget_show (w); if (!pinentry->one_button) { w = gtk_button_new_with_label (pinentry->cancel ? pinentry->cancel : "Cancel"); gtk_container_add (GTK_CONTAINER(bbox), w); gtk_accel_group_add (acc, GDK_Escape, 0, 0, GTK_OBJECT(w), "clicked"); gtk_signal_connect (GTK_OBJECT(w), "clicked", confirm_mode? confirm_button_clicked: button_clicked, NULL); GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT); } gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_CENTER); gtk_widget_show_all (win); return win; }
static void mucharmap_mini_font_selection_init (MucharmapMiniFontSelection *fontsel) { GtkCellRenderer *renderer; GtkStyle *style; AtkObject *accessib; gtk_widget_ensure_style (GTK_WIDGET (fontsel)); style = gtk_widget_get_style (GTK_WIDGET (fontsel)); fontsel->font_desc = pango_font_description_copy (style->font_desc); fontsel->default_size = -1; fontsel->size_adj = gtk_adjustment_new (MIN_FONT_SIZE, MIN_FONT_SIZE, MAX_FONT_SIZE, 1, 8, 0); accessib = gtk_widget_get_accessible (GTK_WIDGET (fontsel)); atk_object_set_name (accessib, _("Font")); gtk_box_set_spacing (GTK_BOX (fontsel), 6); fontsel->family = gtk_combo_box_new (); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (fontsel->family), renderer, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (fontsel->family), renderer, "text", COL_FAMILIY, NULL); gtk_widget_show (fontsel->family); accessib = gtk_widget_get_accessible (fontsel->family); atk_object_set_name (accessib, _("Font Family")); fontsel->bold = gtk_toggle_button_new_with_mnemonic (GTK_STOCK_BOLD); gtk_button_set_use_stock (GTK_BUTTON (fontsel->bold), TRUE); gtk_widget_show (fontsel->bold); g_signal_connect (fontsel->bold, "toggled", G_CALLBACK (bold_toggled), fontsel); fontsel->italic = gtk_toggle_button_new_with_mnemonic (GTK_STOCK_ITALIC); gtk_button_set_use_stock (GTK_BUTTON (fontsel->italic), TRUE); gtk_widget_show (fontsel->italic); g_signal_connect (fontsel->italic, "toggled", G_CALLBACK (italic_toggled), fontsel); fontsel->size = gtk_spin_button_new (GTK_ADJUSTMENT (fontsel->size_adj), 0, 0); gtk_widget_show (fontsel->size); accessib = gtk_widget_get_accessible (fontsel->size); atk_object_set_name (accessib, _("Font Size")); g_signal_connect (fontsel->size_adj, "value-changed", G_CALLBACK (font_size_changed), fontsel); fill_font_families_combo (fontsel); gtk_combo_box_set_active (GTK_COMBO_BOX (fontsel->family), -1); g_signal_connect (fontsel->family, "changed", G_CALLBACK (family_combo_changed), fontsel); gtk_box_pack_start (GTK_BOX (fontsel), fontsel->family, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (fontsel), fontsel->bold, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (fontsel), fontsel->italic, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (fontsel), fontsel->size, FALSE, FALSE, 0); gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (fontsel->family), FALSE); gtk_button_set_focus_on_click (GTK_BUTTON (fontsel->bold), FALSE); gtk_button_set_focus_on_click (GTK_BUTTON (fontsel->italic), FALSE); gtk_container_set_border_width (GTK_CONTAINER (fontsel), 6); gtk_widget_show_all (GTK_WIDGET (fontsel)); }
void cls_inherit_init (AnjutaClassInheritance *plugin) { GtkWidget *s_window; IAnjutaSymbolManager *sym_manager; static IAnjutaSymbolField query_fields_simple[] = { IANJUTA_SYMBOL_FIELD_ID, IANJUTA_SYMBOL_FIELD_NAME, }; static IAnjutaSymbolField query_fields[] = { IANJUTA_SYMBOL_FIELD_ID, IANJUTA_SYMBOL_FIELD_NAME, IANJUTA_SYMBOL_FIELD_RETURNTYPE, IANJUTA_SYMBOL_FIELD_SIGNATURE, IANJUTA_SYMBOL_FIELD_FILE_POS, IANJUTA_SYMBOL_FIELD_FILE_PATH, IANJUTA_SYMBOL_FIELD_ACCESS, IANJUTA_SYMBOL_FIELD_KIND, IANJUTA_SYMBOL_FIELD_TYPE, IANJUTA_SYMBOL_FIELD_TYPE_NAME }; /* Initialize graph layout engine */ cls_inherit_graph_init (plugin, _(DEFAULT_GRAPH_NAME)); s_window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (s_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); plugin->canvas = foo_canvas_new (); foo_canvas_set_scroll_region (FOO_CANVAS (plugin->canvas), -CANVAS_MIN_SIZE/2, -CANVAS_MIN_SIZE/2, CANVAS_MIN_SIZE/2, CANVAS_MIN_SIZE/2); gtk_container_add (GTK_CONTAINER (s_window), plugin->canvas); /* Initialize styles */ gtk_widget_ensure_style (plugin->canvas); on_style_set (plugin->canvas, NULL, plugin); g_signal_connect (G_OBJECT (plugin->canvas), "event", G_CALLBACK (on_canvas_event), plugin); g_signal_connect (G_OBJECT (plugin->canvas), "style_set", G_CALLBACK (on_style_set), plugin); plugin->widget = gtk_vbox_new (FALSE, 2); /* --packing-- */ /* vbox */ gtk_box_pack_start (GTK_BOX (plugin->widget), s_window, TRUE, TRUE, TRUE); gtk_widget_show_all (plugin->widget); /* create new GList */ plugin->nodes = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)cls_node_free); /* menu create */ plugin->menu = gtk_menu_new (); GtkWidget *menu_item = gtk_menu_item_new_with_label (_("Update")); g_signal_connect (menu_item, "activate", (GCallback)on_update_menu_item_selected, plugin); /* set the user data on update selection */ gtk_menu_shell_append (GTK_MENU_SHELL (plugin->menu), menu_item); gtk_widget_show_all (plugin->menu); plugin->update = menu_item; g_object_ref (plugin->menu); g_object_ref (plugin->update); /* Create symbol queries */ sym_manager = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell, IAnjutaSymbolManager, NULL); plugin->query_project = ianjuta_symbol_manager_create_query (sym_manager, IANJUTA_SYMBOL_QUERY_SEARCH_ALL, IANJUTA_SYMBOL_QUERY_DB_PROJECT, NULL); g_signal_connect (plugin->query_project, "async-result", G_CALLBACK (on_cls_inherit_update), plugin); ianjuta_symbol_query_set_mode (plugin->query_project, IANJUTA_SYMBOL_QUERY_MODE_QUEUED, NULL); ianjuta_symbol_query_set_fields (plugin->query_project, sizeof (query_fields_simple)/sizeof (IAnjutaSymbolField), query_fields_simple, NULL); ianjuta_symbol_query_set_filters (plugin->query_project, IANJUTA_SYMBOL_TYPE_CLASS, TRUE, NULL); ianjuta_symbol_query_set_file_scope (plugin->query_project, IANJUTA_SYMBOL_QUERY_SEARCH_FS_PUBLIC, NULL); plugin->query_id = ianjuta_symbol_manager_create_query (sym_manager, IANJUTA_SYMBOL_QUERY_SEARCH_ID, IANJUTA_SYMBOL_QUERY_DB_PROJECT, NULL); ianjuta_symbol_query_set_fields (plugin->query_id, sizeof (query_fields_simple)/sizeof (IAnjutaSymbolField), query_fields_simple, NULL); plugin->query_members = ianjuta_symbol_manager_create_query (sym_manager, IANJUTA_SYMBOL_QUERY_SEARCH_MEMBERS, IANJUTA_SYMBOL_QUERY_DB_PROJECT, NULL); ianjuta_symbol_query_set_fields (plugin->query_members, sizeof (query_fields)/sizeof (IAnjutaSymbolField), query_fields, NULL); plugin->query_parents = ianjuta_symbol_manager_create_query (sym_manager, IANJUTA_SYMBOL_QUERY_SEARCH_CLASS_PARENTS, IANJUTA_SYMBOL_QUERY_DB_PROJECT, NULL); ianjuta_symbol_query_set_fields (plugin->query_parents, sizeof (query_fields_simple)/sizeof (IAnjutaSymbolField), query_fields_simple, NULL); }
/* Standard Border Function */ void hc_draw_shadow(GtkStyle * style, cairo_t * cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget * widget, const gchar * detail, gint x, gint y, gint width, gint height) { /* Border Uses Foreground Color */ CairoColor foreground = HC_STYLE(style)->color_cube.fg[state_type]; gint line_width; gint clip_x = x, clip_y = y, clip_width = width, clip_height = height; /***********************************************/ /* GTK Sanity Checks */ /***********************************************/ CHECK_ARGS /***********************************************/ /* GTK Special Cases - adjust Size/Offset */ /***********************************************/ line_width = HC_STYLE(style)->edge_thickness; if (CHECK_DETAIL (detail, "menubar") && ge_is_panel_widget_item(widget)) { return; } /* Spin Button */ if ((CHECK_DETAIL(detail, "spinbutton_up")) || (CHECK_DETAIL(detail, "spinbutton_down"))) { /* Overdraw Height By Half The Line Width - Prevents Double line Between buttons */ height += floor(line_width / 2); /* If Down Button Offset By Half Line Width */ if (CHECK_DETAIL(detail, "spinbutton_down")) { y -= floor(line_width / 2); } /* Overdraw Width By Line Width - Prevents Double line Between Entry And Buttons */ width += line_width; /* If LTR Offset X By Line Width */ if (ge_widget_is_ltr (widget)) { x -= line_width; } /* Force Border To Use Foreground Widget State */ if (widget) { foreground = HC_STYLE(style)->color_cube.fg[gtk_widget_get_state(widget)]; } } /* Entry - Force Border To Use Foreground Matching Widget State */ if (CHECK_DETAIL(detail, "entry") && !ge_is_combo(widget)) { foreground = HC_STYLE(style)->color_cube.fg[widget ? gtk_widget_get_state(widget) : GTK_STATE_NORMAL]; } /* Combo Box Button's */ if (CHECK_DETAIL(detail, "button") && ge_is_in_combo_box(widget)) { /* Overdraw Width By Line Width - Prevents Double Line Between Entry and Button. */ width += line_width; /* If LTR Offset X By Line Width */ if (ge_widget_is_ltr (widget)) { x -= line_width; } /* Force Border To Use Foreground Matching Parent State */ if ((widget) && (gtk_widget_get_parent(widget))) { gtk_widget_ensure_style(gtk_widget_get_parent(widget)); ge_gdk_color_to_cairo(>k_widget_get_style(gtk_widget_get_parent(widget))->fg[gtk_widget_get_state (widget)], &foreground); } } /***********************************************/ /* Draw Border */ /***********************************************/ /* Clip Border Too Passed Size */ cairo_rectangle(cr, clip_x, clip_y, clip_width, clip_height); cairo_clip(cr); /* Set Line Style */ ge_cairo_set_color(cr, &foreground); cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT); cairo_set_line_width (cr, line_width); ge_cairo_inner_rectangle (cr, x, y, width, height); cairo_stroke(cr); }
static void gtk_widget_query_size_for_orientation (GtkWidget *widget, GtkOrientation orientation, gint for_size, gint *minimum_size, gint *natural_size) { SizeRequestCache *cache; gint min_size = 0; gint nat_size = 0; gboolean found_in_cache; if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_CONSTANT_SIZE) for_size = -1; cache = _gtk_widget_peek_request_cache (widget); found_in_cache = _gtk_size_request_cache_lookup (cache, orientation, for_size, &min_size, &nat_size); if (!found_in_cache) { gint adjusted_min, adjusted_natural, adjusted_for_size = for_size; gtk_widget_ensure_style (widget); if (orientation == GTK_ORIENTATION_HORIZONTAL) { if (for_size < 0) { push_recursion_check (widget, orientation, for_size); GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_size, &nat_size); pop_recursion_check (widget, orientation); } else { gint ignored_position = 0; gint minimum_height; gint natural_height; /* Pull the base natural height from the cache as it's needed to adjust * the proposed 'for_size' */ gtk_widget_get_preferred_height (widget, &minimum_height, &natural_height); /* convert for_size to unadjusted height (for_size is a proposed allocation) */ GTK_WIDGET_GET_CLASS (widget)->adjust_size_allocation (widget, GTK_ORIENTATION_VERTICAL, &minimum_height, &natural_height, &ignored_position, &adjusted_for_size); push_recursion_check (widget, orientation, for_size); GTK_WIDGET_GET_CLASS (widget)->get_preferred_width_for_height (widget, MAX (adjusted_for_size, minimum_height), &min_size, &nat_size); pop_recursion_check (widget, orientation); } } else { if (for_size < 0) { push_recursion_check (widget, orientation, for_size); GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, &min_size, &nat_size); pop_recursion_check (widget, orientation); } else { gint ignored_position = 0; gint minimum_width; gint natural_width; /* Pull the base natural width from the cache as it's needed to adjust * the proposed 'for_size' */ gtk_widget_get_preferred_width (widget, &minimum_width, &natural_width); /* convert for_size to unadjusted width (for_size is a proposed allocation) */ GTK_WIDGET_GET_CLASS (widget)->adjust_size_allocation (widget, GTK_ORIENTATION_HORIZONTAL, &minimum_width, &natural_width, &ignored_position, &adjusted_for_size); push_recursion_check (widget, orientation, for_size); GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, MAX (adjusted_for_size, minimum_width), &min_size, &nat_size); pop_recursion_check (widget, orientation); } } if (min_size > nat_size) { g_warning ("%s %p reported min size %d and natural size %d in %s(); natural size must be >= min size", G_OBJECT_TYPE_NAME (widget), widget, min_size, nat_size, get_vfunc_name (orientation, for_size)); } adjusted_min = min_size; adjusted_natural = nat_size; GTK_WIDGET_GET_CLASS (widget)->adjust_size_request (widget, orientation, &adjusted_min, &adjusted_natural); if (adjusted_min < min_size || adjusted_natural < nat_size) { g_warning ("%s %p adjusted size %s min %d natural %d must not decrease below min %d natural %d", G_OBJECT_TYPE_NAME (widget), widget, orientation == GTK_ORIENTATION_VERTICAL ? "vertical" : "horizontal", adjusted_min, adjusted_natural, min_size, nat_size); /* don't use the adjustment */ } else if (adjusted_min > adjusted_natural) { g_warning ("%s %p adjusted size %s min %d natural %d original min %d natural %d has min greater than natural", G_OBJECT_TYPE_NAME (widget), widget, orientation == GTK_ORIENTATION_VERTICAL ? "vertical" : "horizontal", adjusted_min, adjusted_natural, min_size, nat_size); /* don't use the adjustment */ } else { /* adjustment looks good */ min_size = adjusted_min; nat_size = adjusted_natural; } _gtk_size_request_cache_commit (cache, orientation, for_size, min_size, nat_size); } if (minimum_size) *minimum_size = min_size; if (natural_size) *natural_size = nat_size; g_assert (min_size <= nat_size); GTK_NOTE (SIZE_REQUEST, g_print ("[%p] %s\t%s: %d is minimum %d and natural: %d (hit cache: %s)\n", widget, G_OBJECT_TYPE_NAME (widget), orientation == GTK_ORIENTATION_HORIZONTAL ? "width for height" : "height for width" , for_size, min_size, nat_size, found_in_cache ? "yes" : "no")); }
static void create_calendar(void) { static CalendarData calendar_data; GtkWidget *window, *hpaned, *vbox, *rpane, *hbox; GtkWidget *calendar, *toggle, *scroller, *button; GtkWidget *frame, *label, *bbox, *align, *details; GtkSizeGroup *size; GtkStyle *style; gchar *font; gint i; struct { gboolean init; char *label; } flags[] = { { TRUE, "Show _Heading" }, { TRUE, "Show Day _Names" }, { FALSE, "No Month _Change" }, { TRUE, "Show _Week Numbers" }, { FALSE, "Week Start _Monday" }, { TRUE, "Show De_tails" }, }; calendar_data.window = NULL; calendar_data.font_dialog = NULL; calendar_data.details_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); for (i = 0; i < G_N_ELEMENTS (calendar_data.settings); i++) calendar_data.settings[i] = 0; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "GtkCalendar Example"); gtk_container_set_border_width (GTK_CONTAINER (window), 12); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect (window, "delete-event", G_CALLBACK (gtk_false), NULL); hpaned = gtk_hpaned_new (); /* Calendar widget */ calendar = lunar_calendar_new (); calendar_data.calendar_widget = calendar; frame = create_frame ("<b>Calendar</b>", calendar, 0, 0); gtk_paned_pack1 (GTK_PANED (hpaned), frame, TRUE, FALSE); calendar_data.window = calendar; calendar_set_flags(&calendar_data); gtk_calendar_mark_day (GTK_CALENDAR (calendar), 19); g_signal_connect (calendar, "month_changed", G_CALLBACK (calendar_month_changed), &calendar_data); g_signal_connect (calendar, "day_selected", G_CALLBACK (calendar_day_selected), &calendar_data); g_signal_connect (calendar, "day_selected_double_click", G_CALLBACK (calendar_day_selected_double_click), &calendar_data); g_signal_connect (calendar, "prev_month", G_CALLBACK (calendar_prev_month), &calendar_data); g_signal_connect (calendar, "next_month", G_CALLBACK (calendar_next_month), &calendar_data); g_signal_connect (calendar, "prev_year", G_CALLBACK (calendar_prev_year), &calendar_data); g_signal_connect (calendar, "next_year", G_CALLBACK (calendar_next_year), &calendar_data); rpane = gtk_vbox_new (FALSE, DEF_PAD_SMALL); gtk_paned_pack2 (GTK_PANED (hpaned), rpane, FALSE, FALSE); /* Build the right font-button */ vbox = gtk_vbox_new(FALSE, DEF_PAD_SMALL); frame = create_frame ("<b>Options</b>", vbox, 1, 0); gtk_box_pack_start (GTK_BOX (rpane), frame, FALSE, TRUE, 0); size = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); gtk_widget_ensure_style (calendar); style = gtk_widget_get_style (calendar); font = pango_font_description_to_string (style->font_desc); button = gtk_font_button_new_with_font (font); g_free (font); g_signal_connect (button, "font-set", G_CALLBACK(calendar_select_font), &calendar_data); label = gtk_label_new_with_mnemonic ("_Font:"); gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_size_group_add_widget (size, label); hbox = gtk_hbox_new (FALSE, DEF_PAD_SMALL); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); /* Color button */ GdkColor color; gdk_color_parse("red", &color); button = gtk_color_button_new_with_color(&color); lunar_calendar_set_jieri_color(LUNAR_CALENDAR(calendar), &color); g_signal_connect (button, "color-set", G_CALLBACK(calendar_select_color), &calendar_data); label = gtk_label_new_with_mnemonic ("Holiday _Color:"); gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_size_group_add_widget (size, label); hbox = gtk_hbox_new (FALSE, DEF_PAD_SMALL); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); /* Build the width entry */ button = gtk_spin_button_new_with_range (0, 127, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (button), gtk_calendar_get_detail_width_chars (GTK_CALENDAR (calendar))); g_signal_connect (button, "value-changed", G_CALLBACK (detail_width_changed), &calendar_data); label = gtk_label_new_with_mnemonic ("Details W_idth:"); gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_size_group_add_widget (size, label); hbox = gtk_hbox_new (FALSE, DEF_PAD_SMALL); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); /* Build the height entry */ button = gtk_spin_button_new_with_range (0, 127, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (button), gtk_calendar_get_detail_height_rows (GTK_CALENDAR (calendar))); g_signal_connect (button, "value-changed", G_CALLBACK (detail_height_changed), &calendar_data); label = gtk_label_new_with_mnemonic ("Details H_eight:"); gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_size_group_add_widget (size, label); hbox = gtk_hbox_new (FALSE, DEF_PAD_SMALL); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); #if 0 /* Build the right details frame */ vbox = gtk_vbox_new(FALSE, DEF_PAD_SMALL); frame = create_frame ("<b>Details</b>", vbox, 1, 1); gtk_box_pack_start (GTK_BOX (rpane), frame, FALSE, TRUE, 0); details = gtk_text_view_new(); calendar_data.details_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (details)); calendar_data.details_changed = g_signal_connect (calendar_data.details_buffer, "changed", G_CALLBACK (calendar_details_changed), &calendar_data); scroller = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (scroller), details); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroller), GTK_SHADOW_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_box_pack_start (GTK_BOX (vbox), scroller, FALSE, TRUE, 0); hbox = gtk_hbox_new (FALSE, DEF_PAD_SMALL); align = gtk_alignment_new (0.0, 0.5, 0.0, 0.0); gtk_container_add (GTK_CONTAINER (align), hbox); gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, TRUE, 0); button = gtk_button_new_with_mnemonic ("Demonstrate _Details"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (demonstrate_details), &calendar_data); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0); button = gtk_button_new_with_mnemonic ("_Reset Details"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (reset_details), &calendar_data); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0); toggle = gtk_check_button_new_with_mnemonic ("_Use Details"); g_signal_connect (toggle, "toggled", G_CALLBACK(calendar_toggle_details), &calendar_data); gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, TRUE, 0); #endif /* Build the Right frame with the flags in */ vbox = gtk_vbox_new(FALSE, 0); frame = create_expander ("<b>Flags</b>", vbox, 1, 0); gtk_box_pack_start (GTK_BOX (rpane), frame, TRUE, TRUE, 0); for (i = 0; i < G_N_ELEMENTS (calendar_data.settings); i++) { toggle = gtk_check_button_new_with_mnemonic(flags[i].label); gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, TRUE, 0); calendar_data.flag_checkboxes[i] = toggle; g_signal_connect (toggle, "toggled", G_CALLBACK (calendar_toggle_flag), &calendar_data); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), flags[i].init); } /* * Build the Signal-event part. */ vbox = gtk_vbox_new (TRUE, DEF_PAD_SMALL); frame = create_frame ("<b>Signal Events</b>", vbox, 1, 0); hbox = gtk_hbox_new (FALSE, 3); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); label = gtk_label_new ("Signal:"); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); calendar_data.last_sig = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (hbox), calendar_data.last_sig, FALSE, TRUE, 0); hbox = gtk_hbox_new (FALSE, 3); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); label = gtk_label_new ("Previous signal:"); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); calendar_data.prev_sig = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev_sig, FALSE, TRUE, 0); hbox = gtk_hbox_new (FALSE, 3); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); label = gtk_label_new ("Second previous signal:"); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); calendar_data.prev2_sig = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev2_sig, FALSE, TRUE, 0); /* * Glue everything together */ bbox = gtk_hbutton_box_new (); gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); button = gtk_button_new_with_label ("Close"); g_signal_connect (button, "clicked", G_CALLBACK (gtk_main_quit), NULL); gtk_container_add (GTK_CONTAINER (bbox), button); vbox = gtk_vbox_new (FALSE, DEF_PAD_SMALL); gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, TRUE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); //GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_widget_grab_default (button); gtk_window_set_default_size (GTK_WINDOW (window), 600, 0); gtk_widget_show_all (window); }
void set_todolist_font_str(gchar *fontstr) { gtk_widget_ensure_style(sp->todolist); set_font_str(sp->todolist, fontstr); }
void view_actions_update (GimpActionGroup *group, gpointer data) { GimpDisplay *display = action_data_get_display (data); GimpImage *image = NULL; GimpDisplayShell *shell = NULL; GimpDisplayOptions *options = NULL; GimpColorConfig *color_config = NULL; gchar *label = NULL; gboolean fullscreen = FALSE; gboolean revert_enabled = FALSE; /* able to revert zoom? */ gboolean flip_horizontally = FALSE; gboolean flip_vertically = FALSE; gboolean cm = FALSE; gboolean sp = FALSE; if (display) { GimpImageWindow *window; GimpColorRenderingIntent intent = GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL; gboolean bpc = TRUE; const gchar *action = NULL; image = gimp_display_get_image (display); shell = gimp_display_get_shell (display); window = gimp_display_shell_get_window (shell); if (window) fullscreen = gimp_image_window_get_fullscreen (window); options = (image ? (fullscreen ? shell->fullscreen_options : shell->options) : shell->no_image_options); revert_enabled = gimp_display_shell_scale_can_revert (shell); flip_horizontally = shell->flip_horizontally; flip_vertically = shell->flip_vertically; color_config = gimp_display_shell_get_color_config (shell); switch (color_config->mode) { case GIMP_COLOR_MANAGEMENT_OFF: action = "view-color-management-mode-off"; break; case GIMP_COLOR_MANAGEMENT_DISPLAY: action = "view-color-management-mode-display"; intent = color_config->display_intent; bpc = color_config->display_use_black_point_compensation; cm = TRUE; break; case GIMP_COLOR_MANAGEMENT_SOFTPROOF: action = "view-color-management-mode-softproof"; intent = color_config->simulation_intent; bpc = color_config->simulation_use_black_point_compensation; cm = TRUE; sp = TRUE; break; } gimp_action_group_set_action_active (group, action, TRUE); switch (intent) { case GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL: action = "view-color-management-intent-perceptual"; break; case GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC: action = "view-color-management-intent-relative-colorimetric"; break; case GIMP_COLOR_RENDERING_INTENT_SATURATION: action = "view-color-management-intent-saturation"; break; case GIMP_COLOR_RENDERING_INTENT_ABSOLUTE_COLORIMETRIC: action = "view-color-management-intent-absolute-colorimetric"; break; } gimp_action_group_set_action_active (group, action, TRUE); gimp_action_group_set_action_active (group, "view-color-management-black-point-compensation", bpc); gimp_action_group_set_action_active (group, "view-color-management-gamut-check", color_config->simulation_gamut_check); } #define SET_ACTIVE(action,condition) \ gimp_action_group_set_action_active (group, action, (condition) != 0) #define SET_SENSITIVE(action,condition) \ gimp_action_group_set_action_sensitive (group, action, (condition) != 0) #define SET_COLOR(action,color) \ gimp_action_group_set_action_color (group, action, color, FALSE) SET_SENSITIVE ("view-new", image); SET_SENSITIVE ("view-close", image); SET_SENSITIVE ("view-dot-for-dot", image); SET_ACTIVE ("view-dot-for-dot", display && shell->dot_for_dot); SET_SENSITIVE ("view-zoom-revert", revert_enabled); if (revert_enabled) { label = g_strdup_printf (_("Re_vert Zoom (%d%%)"), ROUND (shell->last_scale * 100)); gimp_action_group_set_action_label (group, "view-zoom-revert", label); g_free (label); } else { gimp_action_group_set_action_label (group, "view-zoom-revert", _("Re_vert Zoom")); } SET_SENSITIVE ("view-zoom", image); SET_SENSITIVE ("view-zoom-minimum", image); SET_SENSITIVE ("view-zoom-maximum", image); SET_SENSITIVE ("view-zoom-in", image); SET_SENSITIVE ("view-zoom-in-accel", image); SET_SENSITIVE ("view-zoom-in-skip", image); SET_SENSITIVE ("view-zoom-out", image); SET_SENSITIVE ("view-zoom-out-accel", image); SET_SENSITIVE ("view-zoom-out-skip", image); SET_SENSITIVE ("view-zoom-fit-in", image); SET_SENSITIVE ("view-zoom-fill", image); SET_SENSITIVE ("view-zoom-selection", image); SET_SENSITIVE ("view-zoom-revert", image); SET_SENSITIVE ("view-zoom-16-1", image); SET_SENSITIVE ("view-zoom-16-1-accel", image); SET_SENSITIVE ("view-zoom-8-1", image); SET_SENSITIVE ("view-zoom-8-1-accel", image); SET_SENSITIVE ("view-zoom-4-1", image); SET_SENSITIVE ("view-zoom-4-1-accel", image); SET_SENSITIVE ("view-zoom-2-1", image); SET_SENSITIVE ("view-zoom-2-1-accel", image); SET_SENSITIVE ("view-zoom-1-1", image); SET_SENSITIVE ("view-zoom-1-1-accel", image); SET_SENSITIVE ("view-zoom-1-2", image); SET_SENSITIVE ("view-zoom-1-4", image); SET_SENSITIVE ("view-zoom-1-8", image); SET_SENSITIVE ("view-zoom-1-16", image); SET_SENSITIVE ("view-zoom-other", image); SET_SENSITIVE ("view-flip-horizontally", image); SET_ACTIVE ("view-flip-horizontally", flip_horizontally); SET_SENSITIVE ("view-flip-vertically", image); SET_ACTIVE ("view-flip-vertically", flip_vertically); SET_SENSITIVE ("view-rotate-reset", image); SET_SENSITIVE ("view-rotate-15", image); SET_SENSITIVE ("view-rotate-345", image); SET_SENSITIVE ("view-rotate-90", image); SET_SENSITIVE ("view-rotate-180", image); SET_SENSITIVE ("view-rotate-270", image); SET_SENSITIVE ("view-rotate-other", image); if (image) { view_actions_set_zoom (group, shell); view_actions_set_rotate (group, shell); } SET_SENSITIVE ("view-navigation-window", image); SET_SENSITIVE ("view-display-filters", image); SET_SENSITIVE ("view-color-management-mode-off", image); SET_SENSITIVE ("view-color-management-mode-display", image); SET_SENSITIVE ("view-color-management-mode-softproof", image); SET_SENSITIVE ("view-color-management-intent-perceptual", cm); SET_SENSITIVE ("view-color-management-intent-relative-colorimetric", cm); SET_SENSITIVE ("view-color-management-intent-saturation", cm); SET_SENSITIVE ("view-color-management-intent-absolute-colorimetric", cm); SET_SENSITIVE ("view-color-management-black-point-compensation", cm); SET_SENSITIVE ("view-color-management-gamut-check", sp); SET_SENSITIVE ("view-color-management-reset", image); SET_SENSITIVE ("view-show-selection", image); SET_ACTIVE ("view-show-selection", display && options->show_selection); SET_SENSITIVE ("view-show-layer-boundary", image); SET_ACTIVE ("view-show-layer-boundary", display && options->show_layer_boundary); SET_SENSITIVE ("view-show-guides", image); SET_ACTIVE ("view-show-guides", display && options->show_guides); SET_SENSITIVE ("view-show-grid", image); SET_ACTIVE ("view-show-grid", display && options->show_grid); SET_SENSITIVE ("view-show-sample-points", image); SET_ACTIVE ("view-show-sample-points", display && options->show_sample_points); SET_SENSITIVE ("view-snap-to-guides", image); SET_ACTIVE ("view-snap-to-guides", display && options->snap_to_guides); SET_SENSITIVE ("view-snap-to-grid", image); SET_ACTIVE ("view-snap-to-grid", display && options->snap_to_grid); SET_SENSITIVE ("view-snap-to-canvas", image); SET_ACTIVE ("view-snap-to-canvas", display && options->snap_to_canvas); SET_SENSITIVE ("view-snap-to-vectors", image); SET_ACTIVE ("view-snap-to-vectors", display && options->snap_to_path); SET_SENSITIVE ("view-padding-color-theme", image); SET_SENSITIVE ("view-padding-color-light-check", image); SET_SENSITIVE ("view-padding-color-dark-check", image); SET_SENSITIVE ("view-padding-color-custom", image); SET_SENSITIVE ("view-padding-color-prefs", image); if (display) { SET_COLOR ("view-padding-color-menu", &options->padding_color); if (shell->canvas) { GtkStyle *style = gtk_widget_get_style (shell->canvas); GimpRGB color; gtk_widget_ensure_style (shell->canvas); gimp_rgb_set_gdk_color (&color, style->bg + GTK_STATE_NORMAL); gimp_rgb_set_alpha (&color, GIMP_OPACITY_OPAQUE); SET_COLOR ("view-padding-color-theme", &color); } } SET_SENSITIVE ("view-show-menubar", image); SET_ACTIVE ("view-show-menubar", display && options->show_menubar); SET_SENSITIVE ("view-show-rulers", image); SET_ACTIVE ("view-show-rulers", display && options->show_rulers); SET_SENSITIVE ("view-show-scrollbars", image); SET_ACTIVE ("view-show-scrollbars", display && options->show_scrollbars); SET_SENSITIVE ("view-show-statusbar", image); SET_ACTIVE ("view-show-statusbar", display && options->show_statusbar); SET_SENSITIVE ("view-shrink-wrap", image); SET_ACTIVE ("view-fullscreen", display && fullscreen); if (GIMP_IS_IMAGE_WINDOW (group->user_data) || GIMP_IS_GIMP (group->user_data)) { GtkWidget *window = NULL; if (shell) window = gtk_widget_get_toplevel (GTK_WIDGET (shell)); /* see view_actions_setup() */ if (GTK_IS_WINDOW (window)) window_actions_update (group, window); } #undef SET_ACTIVE #undef SET_SENSITIVE #undef SET_COLOR }
gboolean alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm) { Dialog dialog; int response_id; GList *icon_list; char *gladefile; g_return_val_if_fail (alarm != NULL, FALSE); dialog.alarm = alarm; dialog.ecal = ecal; gladefile = g_build_filename (EVOLUTION_GLADEDIR, "alarm-dialog.glade", NULL); dialog.xml = glade_xml_new (gladefile, NULL, NULL); g_free (gladefile); if (!dialog.xml) { g_message (G_STRLOC ": Could not load the Glade XML file!"); return FALSE; } if (!get_widgets (&dialog)) { g_object_unref(dialog.xml); return FALSE; } if (!setup_select_names (&dialog)) { g_object_unref (dialog.xml); return FALSE; } init_widgets (&dialog); alarm_to_dialog (&dialog); gtk_widget_ensure_style (dialog.toplevel); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->vbox), 0); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->action_area), 12); icon_list = e_icon_factory_get_icon_list ("stock_calendar"); if (icon_list) { gtk_window_set_icon_list (GTK_WINDOW (dialog.toplevel), icon_list); g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); g_list_free (icon_list); } gtk_window_set_transient_for (GTK_WINDOW (dialog.toplevel), GTK_WINDOW (parent)); response_id = gtk_dialog_run (GTK_DIALOG (dialog.toplevel)); if (response_id == GTK_RESPONSE_OK) dialog_to_alarm (&dialog); gtk_widget_destroy (dialog.toplevel); g_object_unref (dialog.xml); return response_id == GTK_RESPONSE_OK ? TRUE : FALSE; }
void set_note_tree_font_str(gchar *fontstr) { gtk_widget_ensure_style(sp->note_tree); set_font_str(sp->note_tree, fontstr); }
/* This is the main function that checks for a cached size and * possibly queries the widget class to compute the size if it's * not cached. If the for_size here is -1, then get_preferred_width() * or get_preferred_height() will be used. */ static void compute_size_for_orientation (GtkWidget *widget, GtkSizeGroupMode orientation, gint for_size, gint *minimum_size, gint *natural_size) { CachedSize *cached_size; gboolean found_in_cache = FALSE; gint min_size = 0; gint nat_size = 0; found_in_cache = get_cached_size (widget, orientation, for_size, &cached_size); if (!found_in_cache) { gint adjusted_min, adjusted_natural, adjusted_for_size = for_size; gtk_widget_ensure_style (widget); if (orientation == GTK_SIZE_GROUP_HORIZONTAL) { if (for_size < 0) { push_recursion_check (widget, orientation, for_size); GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_size, &nat_size); pop_recursion_check (widget, orientation); } else { gint ignored_position = 0; gint minimum_height; gint natural_height; /* Pull the base natural height from the cache as it's needed to adjust * the proposed 'for_size' */ gtk_widget_get_preferred_height (widget, &minimum_height, &natural_height); /* convert for_size to unadjusted height (for_size is a proposed allocation) */ GTK_WIDGET_GET_CLASS (widget)->adjust_size_allocation (widget, GTK_ORIENTATION_VERTICAL, &minimum_height, &natural_height, &ignored_position, &adjusted_for_size); push_recursion_check (widget, orientation, for_size); GTK_WIDGET_GET_CLASS (widget)->get_preferred_width_for_height (widget, MAX (adjusted_for_size, minimum_height), &min_size, &nat_size); pop_recursion_check (widget, orientation); } } else { if (for_size < 0) { push_recursion_check (widget, orientation, for_size); GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, &min_size, &nat_size); pop_recursion_check (widget, orientation); } else { gint ignored_position = 0; gint minimum_width; gint natural_width; /* Pull the base natural width from the cache as it's needed to adjust * the proposed 'for_size' */ gtk_widget_get_preferred_width (widget, &minimum_width, &natural_width); /* convert for_size to unadjusted width (for_size is a proposed allocation) */ GTK_WIDGET_GET_CLASS (widget)->adjust_size_allocation (widget, GTK_ORIENTATION_HORIZONTAL, &minimum_width, &natural_width, &ignored_position, &adjusted_for_size); push_recursion_check (widget, orientation, for_size); GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, MAX (adjusted_for_size, minimum_width), &min_size, &nat_size); pop_recursion_check (widget, orientation); } } if (min_size > nat_size) { g_warning ("%s %p reported min size %d and natural size %d; natural size must be >= min size", G_OBJECT_TYPE_NAME (widget), widget, min_size, nat_size); } if (orientation == GTK_SIZE_GROUP_HORIZONTAL) _gtk_widget_set_width_request_needed (widget, FALSE); else _gtk_widget_set_height_request_needed (widget, FALSE); adjusted_min = min_size; adjusted_natural = nat_size; GTK_WIDGET_GET_CLASS (widget)->adjust_size_request (widget, orientation == GTK_SIZE_GROUP_HORIZONTAL ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, &adjusted_min, &adjusted_natural); if (adjusted_min < min_size || adjusted_natural < nat_size) { g_warning ("%s %p adjusted size %s min %d natural %d must not decrease below min %d natural %d", G_OBJECT_TYPE_NAME (widget), widget, orientation == GTK_SIZE_GROUP_VERTICAL ? "vertical" : "horizontal", adjusted_min, adjusted_natural, min_size, nat_size); /* don't use the adjustment */ } else if (adjusted_min > adjusted_natural) { g_warning ("%s %p adjusted size %s min %d natural %d original min %d natural %d has min greater than natural", G_OBJECT_TYPE_NAME (widget), widget, orientation == GTK_SIZE_GROUP_VERTICAL ? "vertical" : "horizontal", adjusted_min, adjusted_natural, min_size, nat_size); /* don't use the adjustment */ } else { /* adjustment looks good */ min_size = adjusted_min; nat_size = adjusted_natural; } /* Update size-groups with our request and update our cached requests * with the size-group values in a single pass. */ _gtk_size_group_bump_requisition (widget, orientation, &min_size, &nat_size); commit_cached_size (widget, orientation, for_size, min_size, nat_size); } else { min_size = cached_size->minimum_size; nat_size = cached_size->natural_size; } if (minimum_size) *minimum_size = min_size; if (natural_size) *natural_size = nat_size; g_assert (min_size <= nat_size); GTK_NOTE (SIZE_REQUEST, g_print ("[%p] %s\t%s: %d is minimum %d and natural: %d (hit cache: %s)\n", widget, G_OBJECT_TYPE_NAME (widget), orientation == GTK_SIZE_GROUP_HORIZONTAL ? "width for height" : "height for width" , for_size, min_size, nat_size, found_in_cache ? "yes" : "no")); }
static void charset_combo_box_run_dialog (ECharsetComboBox *combo_box) { GtkDialog *dialog; GtkEntry *entry; GtkWidget *container; GtkWidget *widget; GObject *object; gpointer parent; const gchar *charset; /* FIXME Using a dialog for this is lame. Selecting "Other..." * should unlock an entry directly in the Preferences tab. * Unfortunately space in Preferences is at a premium right * now, but we should revisit this when the space issue is * finally resolved. */ parent = gtk_widget_get_toplevel (GTK_WIDGET (combo_box)); parent = gtk_widget_is_toplevel (parent) ? parent : NULL; object = G_OBJECT (combo_box->priv->other_action); charset = g_object_get_data (object, "charset"); widget = gtk_dialog_new_with_buttons ( _("Character Encoding"), parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); /* Load the broken border width defaults so we can override them. */ gtk_widget_ensure_style (widget); dialog = GTK_DIALOG (widget); //gtk_dialog_set_has_separator (dialog, FALSE); gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK); gtk_container_set_border_width (GTK_CONTAINER (dialog), 12); widget = gtk_dialog_get_action_area (dialog); gtk_container_set_border_width (GTK_CONTAINER (widget), 0); widget = gtk_dialog_get_content_area (dialog); gtk_box_set_spacing (GTK_BOX (widget), 12); gtk_container_set_border_width (GTK_CONTAINER (widget), 0); container = widget; widget = gtk_label_new (_("Enter the character set to use")); gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE); gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); widget = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); gtk_alignment_set_padding (GTK_ALIGNMENT (widget), 0, 0, 12, 0); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); container = widget; widget = gtk_entry_new (); entry = GTK_ENTRY (widget); gtk_entry_set_activates_default (entry, TRUE); gtk_container_add (GTK_CONTAINER (container), widget); gtk_widget_show (widget); g_signal_connect ( entry, "changed", G_CALLBACK (charset_combo_box_entry_changed_cb), dialog); /* Set the default text -after- connecting the signal handler. * This will initialize the "OK" button to the proper state. */ gtk_entry_set_text (entry, charset); if (gtk_dialog_run (dialog) != GTK_RESPONSE_OK) { gint active; /* Revert to the previously selected character set. */ combo_box->priv->block_dialog = TRUE; active = combo_box->priv->previous_index; gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), active); combo_box->priv->block_dialog = FALSE; goto exit; } charset = gtk_entry_get_text (entry); g_return_if_fail (charset != NULL && charset[0] != '\0'); g_object_set_data_full ( object, "charset", g_strdup (charset), (GDestroyNotify) g_free); exit: gtk_widget_destroy (GTK_WIDGET (dialog)); }
/* * 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_gnome_druid_page_standard_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data) { GnomeDruidPageStandard *page; gchar *filename, *title; gchar *wname, *child_name; GdkColor title_color, background_color, logo_background_color; gboolean title_color_set, background_color_set, logo_background_color_set; page = GNOME_DRUID_PAGE_STANDARD (widget); /* We do this to make sure the colors are set. */ gtk_widget_ensure_style (widget); if (data->create_widget) { source_add (data, " %s = gnome_druid_page_standard_new ();\n", data->wname); } gb_widget_write_standard_source (widget, data); g_object_get (G_OBJECT (widget), "title-foreground-set", &title_color_set, "title-foreground-gdk", &title_color, "background-set", &background_color_set, "background-gdk", &background_color, "logo-background-set", &logo_background_color_set, "logo-background-gdk", &logo_background_color, "title", &title, NULL); if (background_color_set) { source_add_decl (data, " GdkColor %s_bg_color = { 0, %i, %i, %i };\n", data->real_wname, background_color.red, background_color.green, background_color.blue); source_add (data, " gnome_druid_page_standard_set_background (GNOME_DRUID_PAGE_STANDARD (%s), &%s_bg_color);\n", data->wname, data->real_wname); } if (logo_background_color_set) { source_add_decl (data, " GdkColor %s_logo_bg_color = { 0, %i, %i, %i };\n", data->real_wname, logo_background_color.red, logo_background_color.green, logo_background_color.blue); source_add (data, " gnome_druid_page_standard_set_logo_background (GNOME_DRUID_PAGE_STANDARD (%s), &%s_logo_bg_color);\n", data->wname, data->real_wname); } if (title_color_set) { source_add_decl (data, " GdkColor %s_title_color = { 0, %i, %i, %i };\n", data->real_wname, title_color.red, title_color.green, title_color.blue); source_add (data, " gnome_druid_page_standard_set_title_foreground (GNOME_DRUID_PAGE_STANDARD (%s), &%s_title_color);\n", data->wname, data->real_wname); } if (gtk_object_get_data (GTK_OBJECT (widget), ContentsBackgroundColor)) { GdkColor *color = &page->contents_background; source_add_decl (data, " GdkColor %s_contents_bg_color = { 0, %i, %i, %i };\n", data->real_wname, color->red, color->green, color->blue); source_add (data, " gnome_druid_page_standard_set_contents_background (GNOME_DRUID_PAGE_STANDARD (%s), &%s_contents_bg_color);\n", data->wname, data->real_wname); } if (title && *title) { gboolean translatable, context; gchar *comments; glade_util_get_translation_properties (widget, Title, &translatable, &comments, &context); source_add_translator_comments (data, translatable, comments); source_add (data, " gnome_druid_page_standard_set_title (GNOME_DRUID_PAGE_STANDARD (%s), %s);\n", data->wname, source_make_string_full (title, data->use_gettext && translatable, context)); } g_free (title); filename = gtk_object_get_data (GTK_OBJECT (widget), LogoImage); if (filename && filename[0]) { source_ensure_decl (data, " GdkPixbuf *tmp_pixbuf;\n"); source_add (data, " tmp_pixbuf = create_pixbuf (\"%s/%s\");\n" " if (tmp_pixbuf)\n" " {\n" " gnome_druid_page_standard_set_logo (GNOME_DRUID_PAGE_STANDARD (%s),\n" " tmp_pixbuf);\n" " gdk_pixbuf_unref (tmp_pixbuf);\n" " }\n", data->program_name, g_basename (filename), data->wname); } filename = gtk_object_get_data (GTK_OBJECT (widget), TopWatermark); if (filename && filename[0]) { source_ensure_decl (data, " GdkPixbuf *tmp_pixbuf;\n"); source_add (data, " tmp_pixbuf = create_pixbuf (\"%s/%s\");\n" " if (tmp_pixbuf)\n" " {\n" " gnome_druid_page_standard_set_top_watermark (GNOME_DRUID_PAGE_STANDARD (%s),\n" " tmp_pixbuf);\n" " gdk_pixbuf_unref (tmp_pixbuf);\n" " }\n", data->program_name, g_basename (filename), data->wname); } /* We output the source code for the children here, since the code should not include calls to create the widgets. We need to specify that the names used are like: "GTK_COMBO (<combo-name>)->entry". 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 = (char*) gtk_widget_get_name (GNOME_DRUID_PAGE_STANDARD (widget)->vbox); child_name = source_create_valid_identifier (child_name); source_add (data, " %s = GNOME_DRUID_PAGE_STANDARD (%s)->vbox;\n", child_name, wname); g_free (child_name); data->create_widget = FALSE; gb_widget_write_source (GNOME_DRUID_PAGE_STANDARD (widget)->vbox, data); g_free (wname); data->write_children = FALSE; }
static VALUE rg_ensure_style(VALUE self) { gtk_widget_ensure_style(_SELF(self)); return self; }
void player_filter_page (GtkWidget *notebook) { GtkWidget *page_hbox; GtkWidget *scrollwin; GtkWidget *label; GtkWidget *vbox; GtkWidget *vbox2; GtkWidget *alignment; GtkWidget *pixmap; GtkWidget *button; GtkWidget *peditor; char *titles[5] = { "", "", "", _("Mode"), _("Pattern") }; int i; page_hbox = gtk_hbox_new (FALSE, 8); gtk_container_set_border_width (GTK_CONTAINER (page_hbox), 8); label = gtk_label_new (_("Player Filter")); gtk_widget_show (label); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page_hbox, label); /* Pattern CList */ scrollwin = gtk_scrolled_window_new (NULL, NULL); gtk_box_pack_start (GTK_BOX (page_hbox), scrollwin, FALSE, FALSE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); pattern_clist = gtk_clist_new_with_titles (5, titles); gtk_widget_set_usize (pattern_clist, 260, 200); gtk_clist_set_selection_mode (GTK_CLIST (pattern_clist), GTK_SELECTION_BROWSE); gtk_clist_set_reorderable (GTK_CLIST (pattern_clist), TRUE); gtk_signal_connect (GTK_OBJECT (pattern_clist), "event", GTK_SIGNAL_FUNC (pattern_clist_event_callback), NULL); gtk_signal_connect (GTK_OBJECT (pattern_clist), "select_row", GTK_SIGNAL_FUNC (pattern_clist_select_row_callback), NULL); gtk_signal_connect (GTK_OBJECT (pattern_clist), "row_move", GTK_SIGNAL_FUNC (pattern_clist_row_move_callback), NULL); for (i = 0; i < 3; i++) { pixmap = aligned_pixmap (group_pix[i].pix, group_pix[i].mask); gtk_clist_set_column_width (GTK_CLIST (pattern_clist), i, pixmap_width (group_pix[i].pix)); gtk_clist_set_column_widget (GTK_CLIST (pattern_clist), i, pixmap); gtk_widget_show (pixmap); gtk_clist_set_column_resizeable (GTK_CLIST (pattern_clist), i, FALSE); } gtk_clist_set_column_width (GTK_CLIST (pattern_clist), 3, 45); gtk_container_add (GTK_CONTAINER (scrollwin), pattern_clist); gtk_clist_column_titles_passive (GTK_CLIST (pattern_clist)); gtk_widget_show (pattern_clist); gtk_widget_show (scrollwin); gtk_widget_ensure_style (pattern_clist); /*FIXME_GTK2: style->font not working with gtk2*/ #ifndef USE_GTK2 i = MAX (pixmap_height (group_pix[0].pix), pattern_clist->style->font->ascent + pattern_clist->style->font->descent + 1); gtk_clist_set_row_height (GTK_CLIST (pattern_clist), i); #endif /* Buttons */ vbox = gtk_vbox_new (FALSE, 4); gtk_box_pack_start (GTK_BOX (page_hbox), vbox, FALSE, FALSE, 0); button = gtk_button_new_with_label (_("New")); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (new_pattern_callback), NULL); gtk_widget_show (button); delete_button = gtk_button_new_with_label (_("Delete")); gtk_box_pack_start (GTK_BOX (vbox), delete_button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (delete_button), "clicked", GTK_SIGNAL_FUNC (delete_pattern_callback), NULL); gtk_widget_show (delete_button); alignment = gtk_alignment_new (0, 0.5, 1, 0); gtk_box_pack_end (GTK_BOX (vbox), alignment, TRUE, TRUE, 0); vbox2 = gtk_vbox_new (FALSE, 4); gtk_container_add (GTK_CONTAINER (alignment), vbox2); up_button = gtk_button_new_with_label (_("Up")); gtk_box_pack_start (GTK_BOX (vbox2), up_button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (up_button), "clicked", GTK_SIGNAL_FUNC (move_up_down_pattern_callback), (void *) -1); gtk_widget_show (up_button); down_button = gtk_button_new_with_label (_("Down")); gtk_box_pack_start (GTK_BOX (vbox2), down_button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (down_button), "clicked", GTK_SIGNAL_FUNC (move_up_down_pattern_callback), (void *) 1); gtk_widget_show (down_button); gtk_widget_show (vbox2); gtk_widget_show (alignment); gtk_widget_show (vbox); /* Pattern Editor */ peditor = player_filter_pattern_editor (); gtk_box_pack_end (GTK_BOX (page_hbox), peditor, TRUE, TRUE, 0); gtk_widget_show (page_hbox); player_filter_page_init (); }
void view_actions_update (GimpActionGroup *group, gpointer data) { GimpDisplay *display = action_data_get_display (data); GimpImage *image = NULL; GimpDisplayShell *shell = NULL; GimpDisplayOptions *options = NULL; gchar *label = NULL; gboolean fullscreen = FALSE; gboolean revert_enabled = FALSE; /* able to revert zoom? */ gboolean use_gegl = FALSE; if (display) { GimpImageWindow *window; image = gimp_display_get_image (display); shell = gimp_display_get_shell (display); window = gimp_display_shell_get_window (shell); if (window) fullscreen = gimp_image_window_get_fullscreen (window); options = (image ? (fullscreen ? shell->fullscreen_options : shell->options) : shell->no_image_options); revert_enabled = gimp_display_shell_scale_can_revert (shell); if (image) use_gegl = gimp_image_get_projection (image)->use_gegl; } #define SET_ACTIVE(action,condition) \ gimp_action_group_set_action_active (group, action, (condition) != 0) #define SET_SENSITIVE(action,condition) \ gimp_action_group_set_action_sensitive (group, action, (condition) != 0) #define SET_COLOR(action,color) \ gimp_action_group_set_action_color (group, action, color, FALSE) SET_SENSITIVE ("view-new", image); SET_SENSITIVE ("view-close", image); SET_SENSITIVE ("view-dot-for-dot", image); SET_ACTIVE ("view-dot-for-dot", display && shell->dot_for_dot); SET_SENSITIVE ("view-zoom-revert", revert_enabled); if (revert_enabled) { label = g_strdup_printf (_("Re_vert Zoom (%d%%)"), ROUND (shell->last_scale * 100)); gimp_action_group_set_action_label (group, "view-zoom-revert", label); g_free (label); } else { gimp_action_group_set_action_label (group, "view-zoom-revert", _("Re_vert Zoom")); } SET_SENSITIVE ("view-zoom-out", image); SET_SENSITIVE ("view-zoom-in", image); SET_SENSITIVE ("view-zoom-fit-in", image); SET_SENSITIVE ("view-zoom-fill", image); SET_SENSITIVE ("view-zoom-16-1", image); SET_SENSITIVE ("view-zoom-8-1", image); SET_SENSITIVE ("view-zoom-4-1", image); SET_SENSITIVE ("view-zoom-2-1", image); SET_SENSITIVE ("view-zoom-1-1", image); SET_SENSITIVE ("view-zoom-1-2", image); SET_SENSITIVE ("view-zoom-1-4", image); SET_SENSITIVE ("view-zoom-1-8", image); SET_SENSITIVE ("view-zoom-1-16", image); SET_SENSITIVE ("view-zoom-other", image); if (image) view_actions_set_zoom (group, shell); SET_SENSITIVE ("view-navigation-window", image); SET_SENSITIVE ("view-display-filters", image); SET_SENSITIVE ("view-show-selection", image); SET_ACTIVE ("view-show-selection", display && options->show_selection); SET_SENSITIVE ("view-show-layer-boundary", image); SET_ACTIVE ("view-show-layer-boundary", display && options->show_layer_boundary); SET_SENSITIVE ("view-show-guides", image); SET_ACTIVE ("view-show-guides", display && options->show_guides); SET_SENSITIVE ("view-show-grid", image); SET_ACTIVE ("view-show-grid", display && options->show_grid); SET_SENSITIVE ("view-show-sample-points", image); SET_ACTIVE ("view-show-sample-points", display && options->show_sample_points); SET_SENSITIVE ("view-snap-to-guides", image); SET_ACTIVE ("view-snap-to-guides", display && shell->snap_to_guides); SET_SENSITIVE ("view-snap-to-grid", image); SET_ACTIVE ("view-snap-to-grid", display && shell->snap_to_grid); SET_SENSITIVE ("view-snap-to-canvas", image); SET_ACTIVE ("view-snap-to-canvas", display && shell->snap_to_canvas); SET_SENSITIVE ("view-snap-to-vectors", image); SET_ACTIVE ("view-snap-to-vectors", display && shell->snap_to_vectors); SET_SENSITIVE ("view-padding-color-theme", image); SET_SENSITIVE ("view-padding-color-light-check", image); SET_SENSITIVE ("view-padding-color-dark-check", image); SET_SENSITIVE ("view-padding-color-custom", image); SET_SENSITIVE ("view-padding-color-prefs", image); if (display) { SET_COLOR ("view-padding-color-menu", &options->padding_color); if (shell->canvas) { GtkStyle *style = gtk_widget_get_style (shell->canvas); GimpRGB color; gtk_widget_ensure_style (shell->canvas); gimp_rgb_set_gdk_color (&color, style->bg + GTK_STATE_NORMAL); gimp_rgb_set_alpha (&color, GIMP_OPACITY_OPAQUE); SET_COLOR ("view-padding-color-theme", &color); } } SET_SENSITIVE ("view-show-menubar", image); SET_ACTIVE ("view-show-menubar", display && options->show_menubar); SET_SENSITIVE ("view-show-rulers", image); SET_ACTIVE ("view-show-rulers", display && options->show_rulers); SET_SENSITIVE ("view-show-scrollbars", image); SET_ACTIVE ("view-show-scrollbars", display && options->show_scrollbars); SET_SENSITIVE ("view-show-statusbar", image); SET_ACTIVE ("view-show-statusbar", display && options->show_statusbar); SET_SENSITIVE ("view-shrink-wrap", image); SET_SENSITIVE ("view-fullscreen", image); SET_ACTIVE ("view-fullscreen", display && fullscreen); SET_ACTIVE ("view-use-gegl", use_gegl); if (GIMP_IS_IMAGE_WINDOW (group->user_data) || GIMP_IS_GIMP (group->user_data)) { GtkWidget *window = NULL; if (shell) window = gtk_widget_get_toplevel (GTK_WIDGET (shell)); /* see view_actions_setup() */ if (GTK_IS_WINDOW (window)) window_actions_update (group, window); } #undef SET_ACTIVE #undef SET_SENSITIVE #undef SET_COLOR }
extern GtkWidget* GL_Create(void) { GtkStyle *ps; gint nMaxWidth; char *asz[] = {NULL, NULL, NULL}; PangoRectangle logical_rect; PangoLayout *layout; asz[0] = _("#"); pwGameList = gtk_clist_new_with_titles(3, asz); gtk_widget_set_can_focus (pwGameList, FALSE); gtk_clist_set_selection_mode( GTK_CLIST( pwGameList ), GTK_SELECTION_BROWSE ); gtk_clist_column_titles_passive( GTK_CLIST( pwGameList ) ); GL_SetNames(); gtk_clist_set_column_justification( GTK_CLIST( pwGameList ), 0, GTK_JUSTIFY_RIGHT ); gtk_clist_set_column_resizeable( GTK_CLIST( pwGameList ), 0, FALSE ); gtk_clist_set_column_resizeable( GTK_CLIST( pwGameList ), 1, FALSE ); gtk_clist_set_column_resizeable( GTK_CLIST( pwGameList ), 2, FALSE ); gtk_widget_ensure_style( pwGameList ); GetStyleFromRCFile(&ps, "gnubg", gtk_widget_get_style( pwGameList ) ); ps->base[ GTK_STATE_SELECTED ] = ps->base[ GTK_STATE_ACTIVE ] = ps->base[ GTK_STATE_NORMAL ] = gtk_widget_get_style( pwGameList )->base[ GTK_STATE_NORMAL ]; ps->fg[ GTK_STATE_SELECTED ] = ps->fg[ GTK_STATE_ACTIVE ] = ps->fg[ GTK_STATE_NORMAL ] = gtk_widget_get_style( pwGameList )->fg[ GTK_STATE_NORMAL ]; gtk_widget_set_style( pwGameList, ps ); psGameList = gtk_style_copy( ps ); psGameList->bg[ GTK_STATE_SELECTED ] = psGameList->bg[ GTK_STATE_NORMAL ] = ps->base[ GTK_STATE_NORMAL ]; psCurrent = gtk_style_copy( psGameList ); psCurrent->bg[ GTK_STATE_SELECTED ] = psCurrent->bg[ GTK_STATE_NORMAL ] = psCurrent->base[ GTK_STATE_SELECTED ] = psCurrent->base[ GTK_STATE_NORMAL ] = psGameList->fg[ GTK_STATE_NORMAL ]; psCurrent->fg[ GTK_STATE_SELECTED ] = psCurrent->fg[ GTK_STATE_NORMAL ] = psGameList->bg[ GTK_STATE_NORMAL ]; GetStyleFromRCFile(&psCubeErrors[SKILL_VERYBAD], "gamelist-cube-blunder", psGameList); GetStyleFromRCFile(&psCubeErrors[SKILL_BAD], "gamelist-cube-error", psGameList); GetStyleFromRCFile(&psCubeErrors[SKILL_DOUBTFUL], "gamelist-cube-doubtful", psGameList); GetStyleFromRCFile(&psChequerErrors[SKILL_VERYBAD], "gamelist-chequer-blunder", psGameList); GetStyleFromRCFile(&psChequerErrors[SKILL_BAD], "gamelist-chequer-error", psGameList); GetStyleFromRCFile(&psChequerErrors[SKILL_DOUBTFUL], "gamelist-chequer-doubtful", psGameList); GetStyleFromRCFile(&psLucky[LUCK_VERYBAD], "gamelist-luck-bad", psGameList); GetStyleFromRCFile(&psLucky[LUCK_VERYGOOD], "gamelist-luck-good", psGameList); layout = gtk_widget_create_pango_layout(pwGameList, "99"); pango_layout_get_pixel_extents (layout, NULL, &logical_rect); g_object_unref (layout); nMaxWidth = logical_rect.width; gtk_clist_set_column_width( GTK_CLIST( pwGameList ), 0, nMaxWidth ); layout = gtk_widget_create_pango_layout(pwGameList, " (set board AAAAAAAAAAAAAA)"); pango_layout_get_pixel_extents (layout, NULL, &logical_rect); g_object_unref (layout); nMaxWidth = logical_rect.width; gtk_clist_set_column_width( GTK_CLIST( pwGameList ), 1, nMaxWidth - 30); gtk_clist_set_column_width( GTK_CLIST( pwGameList ), 2, nMaxWidth - 30); g_signal_connect( G_OBJECT( pwGameList ), "select-row", G_CALLBACK( GameListSelectRow ), NULL ); return pwGameList; }