本文整理汇总了C++中GTK_WINDOW函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_WINDOW函数的具体用法?C++ GTK_WINDOW怎么用?C++ GTK_WINDOW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_WINDOW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cvNamedWindow
CV_IMPL int cvNamedWindow( const char* name, int flags )
{
int result = 0;
CV_FUNCNAME( "cvNamedWindow" );
__BEGIN__;
CvWindow* window;
int len;
cvInitSystem(1,(char**)&name);
if( !name )
CV_ERROR( CV_StsNullPtr, "NULL name string" );
// Check the name in the storage
if( icvFindWindowByName( name ) != 0 )
{
result = 1;
EXIT;
}
len = strlen(name);
CV_CALL( window = (CvWindow*)cvAlloc(sizeof(CvWindow) + len + 1));
memset( window, 0, sizeof(*window));
window->name = (char*)(window + 1);
memcpy( window->name, name, len + 1 );
window->flags = flags;
window->signature = CV_WINDOW_MAGIC_VAL;
window->last_key = 0;
window->on_mouse = 0;
window->on_mouse_param = 0;
memset( &window->toolbar, 0, sizeof(window->toolbar));
window->next = hg_windows;
window->prev = 0;
CV_LOCK_MUTEX();
window->frame = gtk_window_new( GTK_WINDOW_TOPLEVEL );
window->paned = gtk_vbox_new( FALSE, 0 );
window->widget = cvImageWidgetNew( flags );
gtk_box_pack_end( GTK_BOX(window->paned), window->widget, TRUE, TRUE, 0 );
gtk_widget_show( window->widget );
gtk_container_add( GTK_CONTAINER(window->frame), window->paned );
gtk_widget_show( window->paned );
//
// configure event handlers
// TODO -- move this to CvImageWidget ?
gtk_signal_connect( GTK_OBJECT(window->frame), "key-press-event",
GTK_SIGNAL_FUNC(icvOnKeyPress), window );
gtk_signal_connect( GTK_OBJECT(window->widget), "button-press-event",
GTK_SIGNAL_FUNC(icvOnMouse), window );
gtk_signal_connect( GTK_OBJECT(window->widget), "button-release-event",
GTK_SIGNAL_FUNC(icvOnMouse), window );
gtk_signal_connect( GTK_OBJECT(window->widget), "motion-notify-event",
GTK_SIGNAL_FUNC(icvOnMouse), window );
gtk_signal_connect( GTK_OBJECT(window->frame), "delete-event",
GTK_SIGNAL_FUNC(icvOnClose), window );
gtk_widget_add_events (window->widget, GDK_EXPOSURE_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK) ;
gtk_widget_show( window->frame );
gtk_window_set_title( GTK_WINDOW(window->frame), name );
if( hg_windows )
hg_windows->prev = window;
hg_windows = window;
gtk_window_set_resizable( GTK_WINDOW(window->frame), (flags & CV_WINDOW_AUTOSIZE) == 0 );
// allow window to be resized
if( (flags & CV_WINDOW_AUTOSIZE)==0 ){
GdkGeometry geometry;
geometry.min_width = 50;
geometry.min_height = 50;
gtk_window_set_geometry_hints( GTK_WINDOW( window->frame ), GTK_WIDGET( window->widget ),
&geometry, (GdkWindowHints) (GDK_HINT_MIN_SIZE));
}
CV_UNLOCK_MUTEX();
result = 1;
__END__;
return result;
}
示例2: dialog
static gboolean
dialog (void)
{
/* Missing options: Color-dialogs? / own curl layer ? / transparency
to original drawable / Warp-curl (unsupported yet) */
GtkWidget *dialog;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *frame;
GtkWidget *button;
GtkWidget *combo;
GtkObject *adjustment;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY, FALSE);
dialog = gimp_dialog_new (_("Pagecurl Effect"), PLUG_IN_BINARY,
NULL, 0,
gimp_standard_help_func, PLUG_IN_PROC,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dialog));
vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
vbox, TRUE, TRUE, 0);
gtk_widget_show (vbox);
frame = gimp_frame_new (_("Curl Location"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
table = gtk_table_new (3, 2, TRUE);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_container_add (GTK_CONTAINER (frame), table);
curl_image = gtk_image_new ();
gtk_table_attach (GTK_TABLE (table), curl_image, 0, 2, 1, 2,
GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (curl_image);
curl_pixbuf_update ();
{
static const gchar *name[] =
{
N_("Lower right"),
N_("Lower left"),
N_("Upper left"),
N_("Upper right")
};
gint i;
button = NULL;
for (i = CURL_EDGE_FIRST; i <= CURL_EDGE_LAST; i++)
{
button =
gtk_radio_button_new_with_label (button == NULL ?
NULL :
gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)),
gettext (name[i - CURL_EDGE_FIRST]));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
curl.edge == i);
g_object_set_data (G_OBJECT (button),
"gimp-item-data", GINT_TO_POINTER (i));
gtk_table_attach (GTK_TABLE (table), button,
CURL_EDGE_LEFT (i) ? 0 : 1,
CURL_EDGE_LEFT (i) ? 1 : 2,
CURL_EDGE_UPPER (i) ? 0 : 2,
CURL_EDGE_UPPER (i) ? 1 : 3,
GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
gtk_widget_show (button);
g_signal_connect (button, "toggled",
G_CALLBACK (gimp_radio_button_update),
&curl.edge);
g_signal_connect (button, "toggled",
G_CALLBACK (curl_pixbuf_update),
NULL);
}
}
gtk_widget_show (table);
//.........这里部分代码省略.........
示例3: sp_text_edit_dialog
void
sp_text_edit_dialog (void)
{
if (!dlg) {
gchar title[500];
sp_ui_dialog_title_string (Inkscape::Verb::get(SP_VERB_DIALOG_TEXT), title);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
dlg = sp_window_new (title, TRUE);
if (x == -1000 || y == -1000) {
x = prefs->getInt(prefs_path + "x", -1000);
y = prefs->getInt(prefs_path + "y", -1000);
}
if (w ==0 || h == 0) {
w = prefs->getInt(prefs_path + "w", 0);
h = prefs->getInt(prefs_path + "h", 0);
}
// if (x<0) x=0;
// if (y<0) y=0;
if (w && h)
gtk_window_resize ((GtkWindow *) dlg, w, h);
if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE))) {
gtk_window_move ((GtkWindow *) dlg, x, y);
} else {
gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_CENTER);
}
sp_transientize (dlg);
wd.win = dlg;
wd.stop = 0;
g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (sp_transientize_callback), &wd );
gtk_signal_connect ( GTK_OBJECT (dlg), "event", GTK_SIGNAL_FUNC (sp_dialog_event_handler), dlg );
gtk_signal_connect ( GTK_OBJECT (dlg), "destroy", G_CALLBACK (sp_text_edit_dialog_destroy), dlg );
gtk_signal_connect ( GTK_OBJECT (dlg), "delete_event", G_CALLBACK (sp_text_edit_dialog_delete), dlg );
g_signal_connect ( G_OBJECT (INKSCAPE), "shut_down", G_CALLBACK (sp_text_edit_dialog_delete), dlg );
g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_hide", G_CALLBACK (sp_dialog_hide), dlg );
g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_unhide", G_CALLBACK (sp_dialog_unhide), dlg );
gtk_window_set_policy (GTK_WINDOW (dlg), TRUE, TRUE, FALSE);
GtkTooltips *tt = gtk_tooltips_new();
// box containing the notebook and the bottom buttons
GtkWidget *mainvb = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (dlg), mainvb);
// notebook
GtkWidget *nb = gtk_notebook_new ();
gtk_box_pack_start (GTK_BOX (mainvb), nb, TRUE, TRUE, 0);
g_object_set_data (G_OBJECT (dlg), "notebook", nb);
// Font tab
{
GtkWidget *l = gtk_label_new (_("Font"));
GtkWidget *vb = gtk_vbox_new (FALSE, VB_MARGIN);
gtk_container_set_border_width (GTK_CONTAINER (vb), VB_MARGIN);
gtk_notebook_append_page (GTK_NOTEBOOK (nb), vb, l);
/* HBox containing font selection and layout */
GtkWidget *hb = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vb), hb, TRUE, TRUE, 0);
// font and style selector
GtkWidget *fontsel = sp_font_selector_new ();
g_signal_connect ( G_OBJECT (fontsel), "font_set", G_CALLBACK (sp_text_edit_dialog_font_changed), dlg );
g_signal_connect_swapped ( G_OBJECT (g_object_get_data (G_OBJECT(fontsel), "family-treeview")),
"row-activated",
G_CALLBACK (gtk_window_activate_default),
dlg);
gtk_box_pack_start (GTK_BOX (hb), fontsel, TRUE, TRUE, 0);
g_object_set_data (G_OBJECT (dlg), "fontsel", fontsel);
// Layout
{
GtkWidget *f = gtk_frame_new (_("Layout"));
gtk_box_pack_start (GTK_BOX (hb), f, FALSE, FALSE, 4);
GtkWidget *l_vb = gtk_vbox_new (FALSE, VB_MARGIN);
gtk_container_add (GTK_CONTAINER (f), l_vb);
{
GtkWidget *row = gtk_hbox_new (FALSE, VB_MARGIN);
GtkWidget *group;
// align left
{
// TODO - replace with Inkscape-specific call
GtkWidget *px = gtk_image_new_from_stock ( GTK_STOCK_JUSTIFY_LEFT, GTK_ICON_SIZE_LARGE_TOOLBAR );
GtkWidget *b = group = gtk_radio_button_new (NULL);
gtk_tooltips_set_tip (tt, b, _("Align lines left"), NULL);
//.........这里部分代码省略.........
示例4: pidgin_log_show_contact
void pidgin_log_show_contact(PurpleContact *contact) {
struct log_viewer_hash_t *ht;
PurpleBlistNode *child;
PidginLogViewer *lv = NULL;
GList *logs = NULL;
GdkPixbuf *pixbuf;
GtkWidget *image;
const char *name = NULL;
char *title;
int total_log_size = 0;
g_return_if_fail(contact != NULL);
ht = g_new0(struct log_viewer_hash_t, 1);
ht->type = PURPLE_LOG_IM;
ht->contact = contact;
if (log_viewers == NULL) {
log_viewers = g_hash_table_new(log_viewer_hash, log_viewer_equal);
} else if ((lv = g_hash_table_lookup(log_viewers, ht))) {
gtk_window_present(GTK_WINDOW(lv->window));
g_free(ht);
return;
}
for (child = purple_blist_node_get_first_child((PurpleBlistNode*)contact) ;
child != NULL ;
child = purple_blist_node_get_sibling_next(child)) {
const char *buddy_name;
PurpleAccount *account;
if (!PURPLE_BLIST_NODE_IS_BUDDY(child))
continue;
buddy_name = purple_buddy_get_name((PurpleBuddy *)child);
account = purple_buddy_get_account((PurpleBuddy *)child);
logs = g_list_concat(purple_log_get_logs(PURPLE_LOG_IM, buddy_name, account), logs);
total_log_size += purple_log_get_total_size(PURPLE_LOG_IM, buddy_name, account);
}
logs = g_list_sort(logs, purple_log_compare);
image = gtk_image_new();
pixbuf = gtk_widget_render_icon(image, PIDGIN_STOCK_STATUS_PERSON,
gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL), "GtkWindow");
if (pixbuf) {
gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf);
g_object_unref(pixbuf);
} else {
gtk_widget_destroy(image);
image = NULL;
}
if (contact->alias != NULL)
name = contact->alias;
else if (contact->priority != NULL)
name = purple_buddy_get_contact_alias(contact->priority);
/* This will happen if the contact doesn't have an alias,
* and none of the contact's buddies are online.
* There is probably a better way to deal with this. */
if (name == NULL) {
if (contact->node.child != NULL && PURPLE_BLIST_NODE_IS_BUDDY(contact->node.child))
name = purple_buddy_get_contact_alias((PurpleBuddy *) contact->node.child);
if (name == NULL)
name = "";
}
title = g_strdup_printf(_("Conversations with %s"), name);
display_log_viewer(ht, logs, title, image, total_log_size);
g_free(title);
}
示例5: init_main_window
/* Main Window Initialization */
void init_main_window(const gchar * glade_file)
{
GladeXML *xml;
GtkWidget *widget;
GtkTextBuffer *txtbuf;
GtkStyle *style;
xml = glade_xml_new(glade_file, "window1", NULL);
if (!xml)
g_error(_("GUI loading failed !\n"));
glade_xml_signal_autoconnect(xml);
main_wnd = glade_xml_get_widget(xml, "window1");
hpaned = glade_xml_get_widget(xml, "hpaned1");
vpaned = glade_xml_get_widget(xml, "vpaned1");
tree1_w = glade_xml_get_widget(xml, "treeview1");
tree2_w = glade_xml_get_widget(xml, "treeview2");
text_w = glade_xml_get_widget(xml, "textview3");
back_btn = glade_xml_get_widget(xml, "button1");
gtk_widget_set_sensitive(back_btn, FALSE);
widget = glade_xml_get_widget(xml, "show_name1");
gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget,
show_name);
widget = glade_xml_get_widget(xml, "show_range1");
gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget,
show_range);
widget = glade_xml_get_widget(xml, "show_data1");
gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget,
show_value);
save_btn = glade_xml_get_widget(xml, "button3");
save_menu_item = glade_xml_get_widget(xml, "save1");
conf_set_changed_callback(conf_changed);
style = gtk_widget_get_style(main_wnd);
widget = glade_xml_get_widget(xml, "toolbar1");
replace_button_icon(xml, main_wnd->window, style,
"button4", (gchar **) xpm_single_view);
replace_button_icon(xml, main_wnd->window, style,
"button5", (gchar **) xpm_split_view);
replace_button_icon(xml, main_wnd->window, style,
"button6", (gchar **) xpm_tree_view);
txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w));
tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1",
"foreground", "red",
"weight", PANGO_WEIGHT_BOLD,
NULL);
tag2 = gtk_text_buffer_create_tag(txtbuf, "mytag2",
/*"style", PANGO_STYLE_OBLIQUE, */
NULL);
gtk_window_set_title(GTK_WINDOW(main_wnd), rootmenu.prompt->text);
gtk_widget_show(main_wnd);
}
示例6: main
int main (int argc, char **argv)
{
GtkWidget *window;
GtkWidget *button;
GtkWidget *grid;
GtkWidget *entry;
GtkWidget *menu_widget;
GtkAccelGroup *accel_group;
guint i;
GMenu *menu;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_resize (GTK_WINDOW (window), 400, 300);
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (window), grid);
accel_group = gtk_accel_group_new ();
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
/* Button next to entry */
entry = gtk_entry_new ();
gtk_grid_attach (GTK_GRID (grid),
entry,
0, 0,
1, 1);
button = gtk_menu_button_new ();
gtk_grid_attach (GTK_GRID (grid),
button,
1, 0,
1, 1);
/* Button with GtkMenu */
menu_widget = gtk_menu_new ();
for (i = 5; i > 0; i--) {
GtkWidget *item;
if (i == 3) {
item = gtk_menu_item_new_with_mnemonic ("_Copy");
} else {
char *label;
label = g_strdup_printf ("Item _%d", i);
item = gtk_menu_item_new_with_mnemonic (label);
g_free (label);
}
gtk_menu_item_set_use_underline (GTK_MENU_ITEM (item), TRUE);
gtk_menu_attach (GTK_MENU (menu_widget),
item,
0, 1,
i - 1, i);
}
gtk_widget_show_all (menu_widget);
button = gtk_menu_button_new ();
gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu_widget);
gtk_grid_attach (GTK_GRID (grid),
button,
1, 1,
1, 1);
gtk_widget_show (create_prop_editor (G_OBJECT (button), 0));
/* Button with GMenuModel */
menu = g_menu_new ();
for (i = 5; i > 0; i--) {
char *label;
label = g_strdup_printf ("Item _%d", i);
g_menu_insert (menu, i - 1, label, NULL);
g_free (label);
}
button = gtk_menu_button_new ();
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL (menu));
gtk_grid_attach (GTK_GRID (grid),
button,
1, 2,
1, 1);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
示例7: l_uosgrnu
int l_uosgrnu(int metka_rr, //0-ввод и корек. 1-выбор
iceb_u_str *kod,iceb_u_str *naim,GtkWidget *wpredok)
{
l_uosgrnu_data data;
char bros[512];
GdkColor color;
data.poisk.clear_data();
data.metka_rr=metka_rr;
data.window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_position( GTK_WINDOW(data.window),ICEB_POS_CENTER);
gtk_window_set_modal(GTK_WINDOW(data.window),TRUE);
sprintf(bros,"%s %s",name_system,gettext("Список групп налогового учёта"));
gtk_window_set_title (GTK_WINDOW (data.window),bros);
gtk_container_set_border_width (GTK_CONTAINER (data.window), 5);
gtk_signal_connect(GTK_OBJECT(data.window),"delete_event",GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL);
gtk_signal_connect(GTK_OBJECT(data.window),"destroy",GTK_SIGNAL_FUNC(gtk_main_quit),NULL);
if(wpredok != NULL)
{
gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR_GDITE));
//Удерживать окно над породившем его окном всегда
gtk_window_set_transient_for(GTK_WINDOW(data.window),GTK_WINDOW(wpredok));
//Закрыть окно если окно предок удалено
gtk_window_set_destroy_with_parent(GTK_WINDOW(data.window),TRUE);
}
gtk_signal_connect_after(GTK_OBJECT(data.window),"key_press_event",GTK_SIGNAL_FUNC(l_uosgrnu_key_press),&data);
gtk_signal_connect_after(GTK_OBJECT(data.window),"key_release_event",GTK_SIGNAL_FUNC(iceb_key_release),&data.kl_shift);
GtkWidget *hbox = gtk_hbox_new (FALSE, 1);
gtk_container_add (GTK_CONTAINER (data.window), hbox);
GtkWidget *vbox1 = gtk_vbox_new (FALSE, 1);
GtkWidget *vbox2 = gtk_vbox_new (FALSE, 1);
gtk_box_pack_start (GTK_BOX (hbox), vbox1, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
gtk_widget_show(hbox);
data.label_kolstr=gtk_label_new(gettext("Список групп налогового учёта"));
gtk_box_pack_start (GTK_BOX (vbox2),data.label_kolstr,FALSE, FALSE, 0);
gtk_widget_show(vbox1);
gtk_widget_show(vbox2);
data.label_poisk=gtk_label_new ("");
gdk_color_parse("red",&color);
gtk_widget_modify_fg(data.label_poisk,GTK_STATE_NORMAL,&color);
gtk_box_pack_start (GTK_BOX (vbox2),data.label_poisk,FALSE, FALSE, 0);
data.sw = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_usize(GTK_WIDGET(data.sw),400,300);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (data.sw),GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (data.sw),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
gtk_box_pack_end (GTK_BOX (vbox2), data.sw, TRUE, TRUE, 0);
//Кнопки
GtkTooltips *tooltips[KOL_F_KL];
sprintf(bros,"F2 %s",gettext("Запись"));
data.knopka[FK2]=gtk_button_new_with_label(bros);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK2], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK2]), "clicked",GTK_SIGNAL_FUNC(l_uosgrnu_knopka),&data);
tooltips[FK2]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK2],data.knopka[FK2],gettext("Ввод новой записи"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK2]),(gpointer)FK2);
gtk_widget_show(data.knopka[FK2]);
sprintf(bros,"%sF2 %s",RFK,gettext("Корректировать"));
data.knopka[SFK2]=gtk_button_new_with_label(bros);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[SFK2],TRUE,TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[SFK2]), "clicked",GTK_SIGNAL_FUNC(l_uosgrnu_knopka),&data);
tooltips[SFK2]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[SFK2],data.knopka[SFK2],gettext("Корректировка выбранной записи"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[SFK2]),(gpointer)SFK2);
gtk_widget_show(data.knopka[SFK2]);
sprintf(bros,"F3 %s",gettext("Удалить"));
data.knopka[FK3]=gtk_button_new_with_label(bros);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK3],TRUE,TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK3]), "clicked",GTK_SIGNAL_FUNC(l_uosgrnu_knopka),&data);
tooltips[FK3]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK3],data.knopka[FK3],gettext("Удаление выбранной записи"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK3]),(gpointer)FK3);
gtk_widget_show(data.knopka[FK3]);
sprintf(bros,"%sF3 %s",RFK,gettext("Удалить"));
data.knopka[SFK3]=gtk_button_new_with_label(bros);
//.........这里部分代码省略.........
示例8: gui_message_error_dialog
static gboolean
gui_message_error_dialog (Gimp *gimp,
GObject *handler,
GimpMessageSeverity severity,
const gchar *domain,
const gchar *message)
{
GtkWidget *dialog;
if (GIMP_IS_PROGRESS (handler))
{
/* If there's already an error dialog associated with this
* progress, then continue without trying gimp_progress_message().
*/
if (! g_object_get_data (handler, "gimp-error-dialog") &&
gimp_progress_message (GIMP_PROGRESS (handler), gimp,
severity, domain, message))
{
return TRUE;
}
}
else if (GTK_IS_WIDGET (handler))
{
GtkWidget *parent = GTK_WIDGET (handler);
GtkMessageType type = GTK_MESSAGE_ERROR;
switch (severity)
{
case GIMP_MESSAGE_INFO:
type = GTK_MESSAGE_INFO;
break;
case GIMP_MESSAGE_WARNING:
type = GTK_MESSAGE_WARNING;
break;
case GIMP_MESSAGE_ERROR:
type = GTK_MESSAGE_ERROR;
break;
}
dialog =
gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (parent)),
GTK_DIALOG_DESTROY_WITH_PARENT,
type, GTK_BUTTONS_OK,
"%s", message);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
NULL);
gtk_widget_show (dialog);
return TRUE;
}
if (GIMP_IS_PROGRESS (handler) && ! GIMP_IS_PROGRESS_DIALOG (handler))
dialog = progress_error_dialog (GIMP_PROGRESS (handler));
else
dialog = global_error_dialog ();
if (dialog)
{
gimp_error_dialog_add (GIMP_ERROR_DIALOG (dialog),
gimp_get_message_icon_name (severity),
domain, message);
gtk_window_present (GTK_WINDOW (dialog));
return TRUE;
}
return FALSE;
}
示例9: gpk_log_startup_cb
static void
gpk_log_startup_cb (GtkApplication *application, gpointer user_data)
{
g_autoptr(GError) error = NULL;
GtkTreeSelection *selection;
GtkWidget *widget;
GtkWindow *window;
guint retval;
client = pk_client_new ();
g_object_set (client,
"background", FALSE,
NULL);
/* get UI */
builder = gtk_builder_new ();
retval = gtk_builder_add_from_resource (builder,
"/org/gnome/packagekit/gpk-log.ui",
&error);
if (retval == 0) {
g_warning ("failed to load ui: %s", error->message);
goto out;
}
window = GTK_WINDOW (gtk_builder_get_object (builder, "dialog_simple"));
gtk_window_set_icon_name (window, GPK_ICON_SOFTWARE_LOG);
gtk_window_set_application (window, application);
/* set a size, as the screen allows */
gpk_window_set_size_request (window, 1200, 1200);
/* if command line arguments are set, then setup UI */
if (filter != NULL) {
widget = GTK_WIDGET (gtk_builder_get_object (builder, "entry_package"));
gtk_entry_set_text (GTK_ENTRY(widget), filter);
}
widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_refresh"));
g_signal_connect (widget, "clicked", G_CALLBACK (gpk_log_button_refresh_cb), NULL);
gtk_widget_hide (widget);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_filter"));
g_signal_connect (widget, "clicked", G_CALLBACK (gpk_log_button_filter_cb), NULL);
/* hit enter in the search box for filter */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "entry_package"));
g_signal_connect (widget, "activate", G_CALLBACK (gpk_log_button_filter_cb), NULL);
/* autocompletion can be turned off as it's slow */
g_signal_connect (widget, "key-release-event", G_CALLBACK (gpk_log_entry_filter_cb), NULL);
/* create list stores */
list_store = gtk_list_store_new (GPK_LOG_COLUMN_LAST, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
/* create transaction_id tree view */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "treeview_simple"));
gtk_tree_view_set_model (GTK_TREE_VIEW (widget),
GTK_TREE_MODEL (list_store));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
g_signal_connect (selection, "changed",
G_CALLBACK (gpk_log_treeview_clicked_cb), NULL);
/* add columns to the tree view */
pk_treeview_add_general_columns (GTK_TREE_VIEW (widget));
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (widget));
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store),
GPK_LOG_COLUMN_TIMESPEC, GTK_SORT_DESCENDING);
/* show */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_simple"));
gtk_widget_show (widget);
/* set the parent window if it is specified */
if (xid != 0) {
g_debug ("Setting xid %i", xid);
gpk_window_set_parent_xid (GTK_WINDOW (widget), xid);
}
/* get the update list */
gpk_log_refresh ();
out:
g_object_unref (list_store);
g_object_unref (client);
g_free (transaction_id);
g_free (filter);
if (transactions != NULL)
g_ptr_array_unref (transactions);
}
示例10: iceb_l_subbal_v
int iceb_l_subbal_v(class iceb_u_str *kod_gr,GtkWidget *wpredok)
{
class iceb_l_subbal_v_data data;
char strsql[512];
iceb_u_str kikz;
data.kod_gr.new_plus(kod_gr->ravno());
data.rk.clear_data();
if(data.kod_gr.getdlinna() > 1)
{
data.rk.kod.new_plus(data.kod_gr.ravno());
sprintf(strsql,"select * from Glksubbal where kod='%s'",data.kod_gr.ravno());
SQL_str row;
SQLCURSOR cur;
if(iceb_sql_readkey(strsql,&row,&cur,wpredok) < 1)
{
iceb_menu_soob(gettext("Не найдена запись для корректировки !"),wpredok);
return(1);
}
data.rk.naim.new_plus(row[1]);
kikz.plus(iceb_kikz(row[2],row[3],wpredok));
}
else
{
sprintf(strsql,"%d",iceb_get_new_kod("Glksubbal",0,wpredok));
data.rk.kod.new_plus(strsql);
}
data.window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position( GTK_WINDOW(data.window),ICEB_POS_CENTER);
gtk_window_set_modal(GTK_WINDOW(data.window),TRUE);
GtkWidget *label=NULL;
if(data.kod_gr.getdlinna() <= 1)
{
sprintf(strsql,"%s %s",name_system,gettext("Ввод новой записи"));
label=gtk_label_new(gettext("Ввод новой записи"));
}
else
{
sprintf(strsql,"%s %s",name_system,gettext("Корректировка записи"));
iceb_u_str repl;
repl.plus(gettext("Корректировка записи"));
repl.ps_plus(kikz.ravno());
label=gtk_label_new(repl.ravno_toutf());
}
gtk_window_set_title(GTK_WINDOW(data.window),strsql);
gtk_signal_connect(GTK_OBJECT(data.window),"delete_event",GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL);
gtk_signal_connect(GTK_OBJECT(data.window),"destroy",GTK_SIGNAL_FUNC(gtk_main_quit),NULL);
gtk_signal_connect_after(GTK_OBJECT(data.window),"key_press_event",GTK_SIGNAL_FUNC(iceb_l_subbal_v_key_press),&data);
if(wpredok != NULL)
{
gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR_GDITE));
//Удерживать окно над породившем его окном всегда
gtk_window_set_transient_for(GTK_WINDOW(data.window),GTK_WINDOW(wpredok));
//Закрыть окно если окно предок удалено
gtk_window_set_destroy_with_parent(GTK_WINDOW(data.window),TRUE);
}
GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
GtkWidget *hbox[KOLENTER];
for(int i=0; i < KOLENTER; i++)
hbox[i] = gtk_hbox_new (FALSE, 0);
GtkWidget *hboxknop = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (data.window), vbox);
gtk_container_add (GTK_CONTAINER (vbox), label);
for(int i=0; i < KOLENTER; i++)
gtk_container_add (GTK_CONTAINER (vbox), hbox[i]);
gtk_container_add (GTK_CONTAINER (vbox), hboxknop);
label=gtk_label_new(gettext("Код"));
gtk_box_pack_start (GTK_BOX (hbox[E_KOD]), label, FALSE, FALSE, 0);
data.entry[E_KOD] = gtk_entry_new_with_max_length (4);
gtk_box_pack_start (GTK_BOX (hbox[E_KOD]), data.entry[E_KOD], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_KOD]), "activate",GTK_SIGNAL_FUNC(iceb_l_subbal_v_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_KOD]),data.rk.kod.ravno_toutf());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_KOD]),(gpointer)E_KOD);
label=gtk_label_new(gettext("Наименование"));
gtk_box_pack_start (GTK_BOX (hbox[E_NAIM]), label, FALSE, FALSE, 0);
data.entry[E_NAIM] = gtk_entry_new_with_max_length (100);
gtk_box_pack_start (GTK_BOX (hbox[E_NAIM]), data.entry[E_NAIM], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_NAIM]), "activate",GTK_SIGNAL_FUNC(iceb_l_subbal_v_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_NAIM]),data.rk.naim.ravno_toutf());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_NAIM]),(gpointer)E_NAIM);
GtkTooltips *tooltips[KOL_FK];
sprintf(strsql,"F2 %s",gettext("Запись"));
//.........这里部分代码省略.........
示例11: gtk_window_new
/*!
* \brief Create a dialog window containing a pre-defined pixbuf (from
* file).
*
* The \c footprint_name variable is used in the dialog title.
*
* \return 0 when successful.
*/
int
dimensions_create_window
(
gchar *image_filename,
/*!< : is the filename of the image to draw in the
* window.*/
gchar *footprint_type
/*!< : is the footprint type.*/
)
{
/* Create a dimensions window */
GtkWidget *dimensions_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/* Destroy the dimensions window when the main window of pcb-gfpw gets
* destroyed */
gtk_window_set_destroy_with_parent (GTK_WINDOW (dimensions_window),
TRUE);
/* Set the preview window title */
gchar *dimensions_window_title = g_strdup_printf (_("dimensions of %s"),
footprint_type);
gtk_window_set_title (GTK_WINDOW (dimensions_window),
dimensions_window_title);
g_free (dimensions_window_title);
gtk_container_set_border_width (GTK_CONTAINER (dimensions_window), 10);
/* Set the delete signal for the window */
g_signal_connect
(
GTK_OBJECT (dimensions_window),
"delete_event",
(GtkSignalFunc) dimensions_window_delete_event,
NULL
);
/* Create a vertical box */
GtkWidget *vbox = gtk_vbox_new (FALSE, 10);
gtk_container_add (GTK_CONTAINER (dimensions_window), vbox);
/* Load a pre-cooked dimensions image for the footprint type
* and set the name accordingly */
GdkPixbuf *dimensions_image = gdk_pixbuf_new_from_file (image_filename, NULL);
GtkWidget *drawing_area = gtk_drawing_area_new ();
gtk_widget_set_app_paintable (drawing_area, TRUE);
/* Set the expose signal for the window */
g_signal_connect
(
GTK_OBJECT (drawing_area),
"expose-event",
(GtkSignalFunc) dimensions_window_expose_event,
dimensions_image
);
/* Get size of drawing_area and resize */
gint width = gdk_pixbuf_get_width (dimensions_image);
gint height = gdk_pixbuf_get_height (dimensions_image);
gtk_widget_set_size_request (GTK_WIDGET (drawing_area), width, height);
gtk_container_add (GTK_CONTAINER (vbox), drawing_area);
/* Create a horizontal button box */
GtkWidget *hbox = gtk_hbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END);
/* Create a close button */
GtkWidget *button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
g_signal_connect
(
G_OBJECT (button),
"clicked",
G_CALLBACK (dimensions_window_close_cb),
dimensions_window
);
/* Pack the button into the hbox */
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
/* Pack the hbox into the vbox */
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
/* Show the window */
gtk_window_set_resizable (GTK_WINDOW (dimensions_window), FALSE);
gtk_widget_realize (dimensions_window);
gtk_widget_show_all (dimensions_window);
/* Enter the GTK main loop */
gtk_main ();
return 0;
}
示例12: logview_filter_manager_init
static void
logview_filter_manager_init (LogviewFilterManager *manager)
{
GtkWidget *table;
GtkWidget *scrolled_window;
GtkTreeViewColumn *column;
GtkCellRenderer *text_renderer;
LogviewFilterManagerPrivate *priv;
manager->priv = LOGVIEW_FILTER_MANAGER_GET_PRIVATE (manager);
priv = manager->priv;
priv->builder = gtk_builder_new ();
g_object_ref (priv->builder);
priv->prefs = logview_prefs_get ();
gtk_dialog_add_button (GTK_DIALOG(manager),
GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE);
gtk_window_set_modal (GTK_WINDOW (manager),
TRUE);
priv->model = GTK_TREE_MODEL (gtk_list_store_new (N_COLUMNS,
G_TYPE_STRING,
G_TYPE_OBJECT));
logview_filter_manager_update_model (manager);
table = gtk_table_new (3, 2, FALSE);
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_SHADOW_ETCHED_IN);
priv->tree = gtk_tree_view_new_with_model (priv->model);
gtk_widget_set_size_request (priv->tree, 150, 200);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->tree), FALSE);
gtk_container_add (GTK_CONTAINER (scrolled_window), priv->tree);
text_renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new();
gtk_tree_view_column_pack_start (column, text_renderer, TRUE);
gtk_tree_view_column_set_attributes (column,
text_renderer,
"text", COLUMN_NAME,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (priv->tree),
column);
priv->add_button = gtk_button_new_from_stock (GTK_STOCK_ADD);
priv->edit_button = gtk_button_new_from_stock (GTK_STOCK_PROPERTIES);
priv->remove_button = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
gtk_window_set_title (GTK_WINDOW (manager),
_("Filters"));
g_signal_connect (priv->add_button, "clicked",
G_CALLBACK (on_add_clicked), manager);
g_signal_connect (priv->edit_button, "clicked",
G_CALLBACK (on_edit_clicked), manager);
g_signal_connect (priv->remove_button, "clicked",
G_CALLBACK (on_remove_clicked), manager);
gtk_widget_set_sensitive (priv->edit_button, FALSE);
gtk_widget_set_sensitive (priv->remove_button, FALSE);
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree)),
"changed", G_CALLBACK (on_tree_selection_changed),
manager);
gtk_table_attach_defaults (GTK_TABLE (table),
scrolled_window,
0, 1, 0, 3);
gtk_table_attach (GTK_TABLE (table),
priv->add_button,
1, 2, 0, 1, GTK_FILL, 0, 5, 5);
gtk_table_attach (GTK_TABLE (table),
priv->edit_button,
1, 2, 1, 2, GTK_FILL, 0, 5, 5);
gtk_table_attach (GTK_TABLE (table),
priv->remove_button,
1, 2, 2, 3, GTK_FILL, 0, 5, 5);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (manager))),
table, TRUE, TRUE, 5);
gtk_widget_show_all (GTK_WIDGET (manager));
}
示例13: run_add_edit_dialog
//.........这里部分代码省略.........
title = (filter != NULL ? _("Edit filter") : _("Add new filter"));
dialog = GTK_WIDGET (gtk_builder_get_object (builder,
"dialog_filter"));
entry_name = GTK_WIDGET (gtk_builder_get_object (builder,
"entry_name"));
entry_regex = GTK_WIDGET (gtk_builder_get_object (builder,
"entry_regex"));
radio_color = GTK_WIDGET (gtk_builder_get_object (builder,
"radio_color"));
radio_visible = GTK_WIDGET (gtk_builder_get_object (builder,
"radio_visible"));
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_color),
gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_visible)));
check_foreground = GTK_WIDGET (gtk_builder_get_object (builder,
"check_foreground"));
check_background = GTK_WIDGET (gtk_builder_get_object (builder,
"check_background"));
color_foreground = GTK_WIDGET (gtk_builder_get_object (builder,
"color_foreground"));
color_background = GTK_WIDGET (gtk_builder_get_object (builder,
"color_background"));
g_signal_connect (check_foreground, "toggled", G_CALLBACK (on_check_toggled),
color_foreground);
g_signal_connect (check_background, "toggled", G_CALLBACK (on_check_toggled),
color_background);
on_check_toggled (GTK_TOGGLE_BUTTON (check_foreground),
color_foreground);
on_check_toggled (GTK_TOGGLE_BUTTON (check_background),
color_background);
vbox_color = GTK_WIDGET (gtk_builder_get_object (builder, "vbox_color"));
g_signal_connect (radio_color, "toggled", G_CALLBACK (on_check_toggled),
vbox_color);
on_check_toggled (GTK_TOGGLE_BUTTON (radio_color),
vbox_color);
if (filter) {
g_object_get (filter,
"name", &name,
"regex", ®ex,
"texttag", &tag,
NULL);
g_object_get (tag,
"foreground-set", &foreground_set,
"paragraph-background-set", &background_set,
"invisible", &invisible, NULL);
gtk_entry_set_text (GTK_ENTRY(entry_name), name);
gtk_entry_set_text (GTK_ENTRY(entry_regex), regex);
if (foreground_set) {
GdkColor *foreground;
g_object_get (tag, "foreground-gdk", &foreground, NULL);
gtk_color_button_set_color (GTK_COLOR_BUTTON (color_foreground),
foreground);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_foreground),
TRUE);
gdk_color_free (foreground);
}
if (background_set) {
GdkColor *background;
g_object_get (tag, "paragraph-background-gdk", &background, NULL);
gtk_color_button_set_color (GTK_COLOR_BUTTON (color_background),
background);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_background),
TRUE);
gdk_color_free (background);
}
if (background_set || foreground_set) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_color), TRUE);
} else if (invisible) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_visible), TRUE);
}
g_free (regex);
g_object_unref (tag);
}
g_object_set_data_full (G_OBJECT (manager), "old_name", name, g_free);
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (on_dialog_add_edit_reponse), manager);
gtk_window_set_transient_for (GTK_WINDOW (dialog),
GTK_WINDOW (manager));
gtk_window_set_modal (GTK_WINDOW (dialog),
TRUE);
gtk_widget_show (GTK_WIDGET (dialog));
}
示例14: on_dialog_add_edit_reponse
static void
on_dialog_add_edit_reponse (GtkWidget *dialog, int response_id,
LogviewFilterManager *manager)
{
GtkWidget *entry_name, *entry_regex;
GtkWidget *radio_color, *radio_visible;
GtkWidget *check_foreground, *check_background;
GtkWidget *color_foreground, *color_background;
gchar *old_name;
const gchar *name;
const gchar *regex;
LogviewFilter *filter;
GtkTextTag *tag;
GtkBuilder *builder;
old_name = g_object_get_data (G_OBJECT (manager), "old_name");
builder = manager->priv->builder;
entry_name = GTK_WIDGET (gtk_builder_get_object (builder,
"entry_name"));
entry_regex = GTK_WIDGET (gtk_builder_get_object (builder,
"entry_regex"));
radio_color = GTK_WIDGET (gtk_builder_get_object (builder,
"radio_color"));
radio_visible = GTK_WIDGET (gtk_builder_get_object (builder,
"radio_visible"));
check_foreground = GTK_WIDGET (gtk_builder_get_object (builder,
"check_foreground"));
check_background = GTK_WIDGET (gtk_builder_get_object (builder,
"check_background"));
color_foreground = GTK_WIDGET (gtk_builder_get_object (builder,
"color_foreground"));
color_background = GTK_WIDGET (gtk_builder_get_object (builder,
"color_background"));
if (response_id == GTK_RESPONSE_APPLY) {
name = gtk_entry_get_text (GTK_ENTRY (entry_name));
regex = gtk_entry_get_text (GTK_ENTRY (entry_regex));
if (!check_name (manager, name) || !check_regex (manager, regex)) {
return;
}
filter = logview_filter_new (name, regex);
tag = gtk_text_tag_new (name);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_color))) {
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_foreground))) {
GdkColor foreground_color;
gtk_color_button_get_color (GTK_COLOR_BUTTON (color_foreground),
&foreground_color);
g_object_set (G_OBJECT (tag),
"foreground-gdk", &foreground_color,
"foreground-set", TRUE, NULL);
}
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_background))) {
GdkColor background_color;
gtk_color_button_get_color (GTK_COLOR_BUTTON (color_background),
&background_color);
g_object_set (tag,
"paragraph-background-gdk", &background_color,
"paragraph-background-set", TRUE, NULL);
}
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_foreground))
&& !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_background))) {
GtkWidget *error_dialog;
error_dialog = gtk_message_dialog_new (GTK_WINDOW (manager),
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s",
_("Please specify either foreground or background color!"));
gtk_dialog_run (GTK_DIALOG (error_dialog));
gtk_widget_destroy (error_dialog);
g_object_unref (tag);
g_object_unref (filter);
return;
}
} else { /* !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_color)) */
g_object_set (tag, "invisible", TRUE, NULL);
}
if (old_name && !g_str_equal (old_name, name)) {
logview_prefs_remove_filter (manager->priv->prefs, old_name);
}
g_object_set (G_OBJECT (filter), "texttag", tag, NULL);
g_object_unref (tag);
logview_prefs_add_filter (manager->priv->prefs, filter);
g_object_unref (filter);
logview_filter_manager_update_model (manager);
}
gtk_widget_destroy (dialog);
//.........这里部分代码省略.........
示例15: main
int main (int argc, char *argv[])
{
/*init critical variables*/
bServerOnline = false;
bConsoleActive = false;
/*init resources*/
GtkWidget *window;
/*init threads*/
g_thread_init(NULL);
gdk_threads_init();
gdk_threads_enter();
add_console_msg("[Lucky",motd, "SoftServer Build "+convert_to_str(BUILD_NUM)+"\nhttp://www.softserver.org\n\nAre you still using the trial version?\nDevelop an app using SoftServer and submit it to earn a license!");
add_console_msg("[Main]",notification,"Initializing GTK+ v2.0");
/*init GTK*/
gtk_init(&argc, &argv);
/*Window setup*/
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW (window), std::string("SoftServer Build "+convert_to_str(BUILD_NUM)).c_str());
gtk_window_set_default_size(GTK_WINDOW(window), 550, 350);
gtk_window_set_resizable(GTK_WINDOW(window), false);
/*Console*/
console_text = gtk_text_view_new(); //Start console up
console_buffer = gtk_text_view_get_buffer((GtkTextView*)console_text);
while(!start_console_format()); //Start up formats
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(console_text), GTK_WRAP_WORD);
gtk_text_view_set_editable(GTK_TEXT_VIEW(console_text), false);
gtk_widget_set_size_request(console_text, 595, 345);
GdkColor console_color_bg;
console_color_bg.red = 0;
console_color_bg.green = 0;
console_color_bg.blue = 0;
gtk_widget_modify_base(console_text, GTK_STATE_NORMAL, &console_color_bg);
/*Label setup*/
status_msg = gtk_label_new(NULL);
change_status_msg("SoftServer <i>Build "+convert_to_str(BUILD_NUM)+"</i>");
start_and_stop_button = gtk_button_new_with_label("Start");
fixed_location = gtk_fixed_new();
gtk_fixed_put(GTK_FIXED(fixed_location), console_text,0,0);
gtk_fixed_put(GTK_FIXED(fixed_location), status_msg, 5, 360);
gtk_fixed_put(GTK_FIXED(fixed_location), start_and_stop_button, 550, 350);
gtk_container_add(GTK_CONTAINER(window), fixed_location);
/*Show widgets here*/
gtk_container_set_border_width(GTK_CONTAINER(window), 5);
gtk_widget_show_all(window);
add_console_msg("[Main]", notification,"Waiting for start button to be pressed");
start_stop_button_ls_id = g_signal_connect_after(start_and_stop_button, "released", G_CALLBACK(init_serv), NULL);
g_signal_connect(window, "destroy", G_CALLBACK(destroy), NULL);
activate_console();
/*Exit*/
gtk_main();
gdk_threads_leave();
return 0;
}