Re: How to get GtkNotebook tab padding?
On 09/12/2018 01:58 PM, Game On via gtk-app-devel-list wrote: > Hi,What's the correct way to get the tab padding of a GtkNotebook widget? > It's easy enough to set them, but I'm not sure how to get those values back? > My custom gtk.css file with:notebook tab { padding: 20px 20px 20px 20px; > } > I've tried many incantations, including this without success:// Assume I have > GtkWidgetPath path and GtkStyleContext > contextgtk_widget_path_append_type(path, GTK_TYPE_NOTEBOOK); > gtk_style_context_set_path(context, > path);gtk_style_context_add_class(context, "tab"); > > GtkBorder padding;gtk_style_context_get_padding(context, > GTK_STATE_FLAG_NORMAL, &padding); > > Thanks for your help. I'm not sure with Gtk+3, but prior to that you would use g_object_get (GTK_NOTEBOOK (notebook), property1, &val1, property2, &val2, NULL); See the manual (and it does apply in Gtk+3) https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#g-object-get -- David C. Rankin, J.D.,P.E. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Howto register/unregister words completion provider on buffer change in textview?
On 09/16/2018 03:21 AM, David C. Rankin wrote: > Each treemodel entry has a struct containing a pointer to its > GtkSourceCompletionWords provider. Uugh... That should read the editor instance struct associated with the sourceview has a pointer to its GtkSourceCompletionWords provider. (the tree model just holds a struct containing a pointer to its GtkSourceBuffer which is what allows updating the textview/sourceview window on the right with the new buffer). So when I click a different file in the treeview, I want to associate that buffer as the word-source for the GtkSourceCompletionWords provider for the textview by unregistering the existing buffer as the word-source and registering the new buffer as the source for the provider in the textview. -- David C. Rankin, J.D.,P.E. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Howto register/unregister words completion provider on buffer change in textview?
All, I have an editor that holds the open files on the left in a treeview/treemodel and displays the buffer containing each file in a textview (sourceview) window on the right. Each treemodel entry has a struct containing a pointer to its GtkSourceCompletionWords provider. The word-completion works fine for the first buffer shown in the window, but when I change files and display a different buffer in the textview window, I am not able to register/unregister the current buffer from the words provider and use the new buffer as a source? Essentially I create the initial completion object as: GtkSourceCompletion *completion; GtkSourceCompletionWords *prov_words; completion = gtk_source_view_get_completion (view); prov_words = gtk_source_completion_words_new (NULL, NULL); gtk_source_completion_words_register (prov_words, gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); gtk_source_completion_add_provider (completion, GTK_SOURCE_COMPLETION_PROVIDER (prov_words), NULL); /* store a pointer to the completions words provider as part of * the editor instance. */ einst->prov_words = prov_words; When displaying a new buffer in the textview, I use the treeview "changed" signal to display the new buffer, update the window title, etc.. and I tried to unregister the current buffer from the prov_words provider and then register the new buffer as the word source with: GtkSourceCompletionWords *prov_words = einst->prov_words; /* unregister current buffer from words completion provider */ gtk_source_completion_words_unregister (prov_words, GTK_TEXT_BUFFER(oldbuf)); /* register new buffer with words completion provider */ gtk_source_completion_words_register (prov_words, GTK_TEXT_BUFFER(newbuf)); However, I am obviously missing something as the new buffer displayed does not provide any completion functionality at all. Since the completion object (GtkSourceCompletion) is part of the sourceview (GtkSourceView) and the completion provider (GtkSourceCompletionWords) is part of the completion object, there should be no need to create another object or provider as the sourceview window is the same. The only thing that I see that needs doing is to change the buffer registered as the source of words for the provider on buffer change -- but so far I have not met with any success... Is there something I am missing when changing the buffer in the sourceview that is needed to change the completion so that word completion continues to function but simply drawing words from the new buffer instead of the old? When I switch focus back to the original buffer -- completion works fine again, it's something in the switch to the new that I must be missing. Help? -- David C. Rankin, J.D.,P.E. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list