; Module/File: Panel_RemovePlaceholderImageGtk3.pb ; Function: Removes the placeholder image or set the size to '0' in gtk3 tabs (temporarily until it's fixed) - Linux gtk3 ; Author: Omi ; Date: Jul. 09, 2016 ; Version: 0.2 ; Target Compiler: PureBasic 5.22/5.31/5.4/5.6 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ; Link to topic: http://www.purebasic.fr/english/viewtopic.php?f=23&t=66100 ;-------------------------------------------------------------- ;Workaround against too wide tabs and a text, displaced to the right! ;If no images are used in the tabs !!! EnableExplicit ImportC "" gtk_image_set_pixel_size(*image.GtkImage, pixel_size) EndImport ; Object constants #Win_Main= 0 #Panel1 = 0 Global.i gEvent, gQuit Global.i gI Procedure PanelTab_RemoveImgSpacer(Gadget) Protected *notebook.GtkNotebook= GadgetID(Gadget) Protected *Widget.GtkWidget, *gHBox.GtkHBox Protected *gList.GList Protected.i I, O Protected.i Tabs= gtk_notebook_get_n_pages_(GadgetID(Gadget)) For I= 0 To Tabs- 1 *Widget= gtk_notebook_get_nth_page_(*notebook, I); panel widget *gHBox= gtk_notebook_get_tab_label_(*notebook, *Widget); hbox from tab for panel If *gHBox *gList= gtk_container_get_children_(*gHBox) For O= 1 To g_list_length_(*gList) If PeekS(gtk_widget_get_name_(g_list_nth_data_(*gList, O-1)), -1, #PB_UTF8) = "GtkImage" ;set size to '0' ... ;gtk_image_set_pixel_size(g_list_nth_data_(*gList, O-1), 0) ;OR remove image ... gtk_container_remove_(*gHBox, g_list_nth_data_(*gList, O-1)) EndIf Next O g_list_free_(*gList) EndIf Next I EndProcedure If OpenWindow(#Win_Main, 300, 200, 400, 310, "PanelGadget: gtk3 empty-tab-image fix", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) PanelGadget(#Panel1, 0, 30, 400, 270) For gI= 0 To 3 AddGadgetItem(#Panel1, -1, " Tab "+Str(gI)) TextGadget(#PB_Any, 5, 5, 200, 20, "Panel "+Str(gI)) Next gI ;comment out the next line to see default behaviour ... PanelTab_RemoveImgSpacer(#Panel1) Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True EndSelect Until gQuit EndIf End ; IDE Options = PureBasic 5.46 LTS Beta 2 (Linux - x86) ; CursorPosition = 60 ; Folding = - ; EnableUnicode ; EnableXP