Re: Reg. modifying GTK+ to add menu option
Hello. Hmm... I use goldendict for similar functionality. goldendict has a special key (default win+alt). When special key is pressed, current selected word will be translated in pop-up window, as it is shown in your first screenshot. How does goldendict do it? I think he scan all keypress actions from X server, may be Qt helps him. As I know, GNOME can add user's action to keypress. May be you need hack GNOME dict and GNONE, not gtk+. I think, adding new context menu to gtk+ is a bad choice. gtk+ is toolkit for making GUI and is not suitable for this purpose. gtk+ is used on systems that do not have GNOME dict or GNOME. New context menu is useless for those systems. How I see the solution to this problem: GNOME must have special key with action look up word. On this action GNOME must send selected word (I think it's not a big problem to get selected word) to GNOME dict. dict shows pop-up window with definition. Good luck with this feature. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Toggle button which enables GtkTextTag
Here is my code: http://pastebin.com/ycbnmxw0 It's work on selection, but don't work as switch for bold mode. Please help me. What i need to do? p.s. If you know applications that got same behavior, tell me about it. I was searched in pidgin, but his source too big. В Чт., 08/11/2012 в 00:10 +0400, Vlasov Vitaly пишет: I created TextView with TextBuffer with TextTagTable, filled by my TextTag's and ToggleButton. With ToggleButton i want enable mytag mode. Button must work as like in LibreOffice Writer. When i activate bold mode printing text will be bold. And, if i disable bold mode printing text will be not tagged. So, my pseudo-code ToggleButton activate callback: GtkTextIter start; GtkTextIter end; gint cursor_offset; if(buffer_has_selection) { ... working code } else /* Enable my_tag mode here */ { if(button_is_active) { g_object_get(text_buff, cursor-position, cursor_offset, NULL); gtk_text_buffer_get_iter_at_offset(text_buff, start, cursor_offset); gtk_text_buffer_apply_tag_by_name(text_buff, mytag, start, end); } } It does not work. Printing text still untagged. I am on right way? How to make this button? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Toggle button which enables GtkTextTag
I created TextView with TextBuffer with TextTagTable, filled by my TextTag's and ToggleButton. With ToggleButton i want enable mytag mode. Button must work as like in LibreOffice Writer. When i activate bold mode printing text will be bold. And, if i disable bold mode printing text will be not tagged. So, my pseudo-code ToggleButton activate callback: GtkTextIter start; GtkTextIter end; gint cursor_offset; if(buffer_has_selection) { ... working code } else /* Enable my_tag mode here */ { if(button_is_active) { g_object_get(text_buff, cursor-position, cursor_offset, NULL); gtk_text_buffer_get_iter_at_offset(text_buff, start, cursor_offset); gtk_text_buffer_apply_tag_by_name(text_buff, mytag, start, end); } } It does not work. Printing text still untagged. I am on right way? How to make this button? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkTreeIter assignment
Hello list. Is that normal, to assign one GtkTreeIter to another? For example: void add_new( ... , GtkTreeIter *iter) { GtkTreeIter *default_iter; if(iter != NULL) { default_iter = iter; -- is that noraml?? } gtk_tree_store_append(default_iter); } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkTreeIter assignment
Oops! GtkTreeIter *default_iter -- GtkTreeIter default_iter; It's question about: default_iter = *iter; -- is that normal? I can give you more verbose example(it's pseudo-code, not C): prepare_iter() { GtkTreeIter iter; gtk_tree_store_insert_after( ... , iter , ...); add_new_entry(model, iter); } add_new_entry(GtkTreeModel, GtkTreeIter *iter) { GtkTreeIter default_iter; GtkTreeStore *store = GTK_TREE_STORE(model); if(iter != NULL) { default_iter = *iter; -- i need that } else gtk_tree_store_append(... , default_iter, ...); gtk_tree_store_set(store, default_iter, 1, name, -1); } So, i need to call add_new_entry() somewhere outside with some model and second NULL arg. If you're interested, this is how i doing right now: http://pastebin.com/QKDivBub It's work, but i don't like it. В Вт., 30/10/2012 в 14:36 +0100, David Nečas пишет: On Tue, Oct 30, 2012 at 05:05:37PM +0400, Vlasov Vitaly wrote: Is that normal, to assign one GtkTreeIter to another? For example: void add_new( ... , GtkTreeIter *iter) { GtkTreeIter *default_iter; if(iter != NULL) { default_iter = iter; -- is that noraml?? This is pointer assignment: default_iter will denote the same chunk of memory as iter. What exactly should be abnormal here? } gtk_tree_store_append(default_iter); This is invalid code: wrong number of arguments of wrong type. And, of course, default_iter is possibly being used uninitialised. Yeti ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkToggleButton with GTK_STOCK item
Hello. How to create GtkTogleButton with Icon and Label from STOCK? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
vim gtk+3.0 syntax
Hello, all. Is GTK3.0 Vim syntax highlighting exist? I found in Internet python script vim-sym-gen.py, that generate symbols from gtk-doc, but don't know how to use it. Where to find manual/how-to to this script? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: how to get entry from GtkComboBoxEntry?
Thank you! I don't quite get the difference between empty entry and user-typed text (she could type something and then delete it, for instance). Simple pseudo-code: button_callback(save_lang_button, ComboBoxEntry) if(combobox selected) do_work else { if(entry is empty) this_is_error() else do_work_with_entry_val() } Use gtk_bin_get_child(comboboxentry) to get the GtkComboBoxEntry's GtkEntry widget. Thank you, it should help. Is gtk_bin_get_child() always return GtkEntry widget? В Вт., 11/09/2012 в 13:38 +0200, David Nečas пишет: On Tue, Sep 11, 2012 at 03:29:10PM +0400, Vlasov Vitaly wrote: I wanna use some ComboBox/Entry widget: It should contain tree model with language names and hidden ISO 639-1 codes, for example English(en) German(de) Russian(ru) or other. And, in addition, it should allow to user write ISO 639-1 language code from keyboard. So, with tree i can get selected value and respectively get lang code from tree. When in ComboBox is not selected values, it could mean: 1) User set it from keyboard 2) Entry is empty. It is possible to create ComboBox with tree model and separate entry, but i don't like that way. How to check, whether the user has entered a value from the keyboard or entry is empty? May be i should use other Entry/ComboBox widget? I used before GtkEntryCompletion. It work's, but it uncomfortable with two-letter ISO codes. Now i use gtk-2.0, but later will switch to 3.0. As i can see, in gtk-3.0 GtkComboBox and GtkComboxEntry is same thing. But i still can't get entry widget from gtk-3.0 ComboBox. I don't quite get the difference between empty entry and user-typed text (she could type something and then delete it, for instance). Anyway, I will try to answer the simple part: Use gtk_bin_get_child(comboboxentry) to get the GtkComboBoxEntry's GtkEntry widget. Regards, Yeti ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GList strange behavior
Thank you! I almost understand bahavior of GList. I need to save newly created list poiner. So, i need to use g_list_last() to save it? Is there another method to save created list pointer? В сообщении от Четверг 16 августа 2012 15:51:22 вы написали: Hi. Not sure what is troubling you here. GList is represented by pointer to first element or NULL if list is empty. And when you append items to the list, the address of the list stays the same, since first element of the list is unchanged (exception to this is when append first element to an empty list). Some code to explain some things: GList *list = NULL /* Empty list */ list = g_list_append (list, GINT_TO_POINTER (1)); /* Add first element, list points to some ADDR1 */ list = g_list_append (list, GINT_TO_POINTER (2)); /* Add second element, list still points to ADDR1 */ ... Cheers, Tadej ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
widget_destroy() question
Hello list. For example, i got frame in which packed vbox. In vbox packed in five buttons. If i call gtk_widget_destroy(), all packed widget's will be destroyed? or only frame? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GList strange behavior
Hello Thanks for answer. Did you mean Last list element: 0x832c610 is differ from INIT list prt: 0x830f080? No. Lest's see... i got function do_work with: 1. new Glist init with random data 2. callback definition of button click: button_click(, GList *list) let init list poiner = 0xfe button was clicked! Here button_click(GList *list) list in agrs = 0xfe new data record memory allocation. !!! g_list_append(data, list) !!! In my example it returns init list value (0xfe), but should returns value of newly created list (0x832c610 in example). In example: INIT list prt: 0x830f080 - this is init list, which passed to button_callback In button callback: Created: 0x830f080, arg: 0x830f080 - first ptr is returned list from g_list_append(), but it equal to init list. WTF??? HOW?? I need newly created list here... And i check added value with g_list_last(). It's equal 0x832c610 and correct. So, why g_list_append() dont' return me newly created list??? В сообщении от Среда 15 августа 2012 09:33:04 вы написали: Hi, In button_cb()... Did you mean Last list element: 0x832c610 is differ from INIT list prt: 0x830f080? It's clear because 0x830f080 was the location of first list and 0x832c610 is the last appended list. g_list_prepend() return to the start of the list, g_list_last() return the last of the list (address). in test_glist() First you call temp = g_list_insert(test, ...), test = NULL, save the list to temp pointer to GList, second, you call temp = g_list_append(test, ...), nothing wrong with that code! BUT if you suppose to insert 2nd list here, then you are wrong. Because, test is STILL NULL. It returns the newly allocated list again, that's why it's differ. You should call call temp = g_list_append(temp,...) or to insert the next list. In real program, i need to get newly created list pointer in function like button_cb(), but don't know how to do it. Just pass it through callback's argument or declare it as global variable. On Wed, Aug 15, 2012 at 8:04 AM, Vlasov Vitaly vnig...@gmail.com wrote: Hi, list. I can't understand, why g_list_append return different values in my callback's(please read source). In first case i got same list, which was obtained from arguments. In second case g_list_append returns newly created list. Why result's is are not the same? In real program, i need to get newly created list pointer in function like button_cb(), but don't know how to do it. source: http://pastebin.com/4gMREKwd output on my laptop: INIT list prt: 0x830f080 Created: 0x830f080, arg: 0x830f080 Last list element: 0x832c610 Init list ptr: 0x832c5c0 Second list ptr: 0x830f120 End ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GList strange behavior
Hi, list. I can't understand, why g_list_append return different values in my callback's(please read source). In first case i got same list, which was obtained from arguments. In second case g_list_append returns newly created list. Why result's is are not the same? In real program, i need to get newly created list pointer in function like button_cb(), but don't know how to do it. source: http://pastebin.com/4gMREKwd output on my laptop: INIT list prt: 0x830f080 Created: 0x830f080, arg: 0x830f080 Last list element: 0x832c610 Init list ptr: 0x832c5c0 Second list ptr: 0x830f120 End ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list