<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <span id="result_box" class="" lang="en"><span>Hello:</span><br>
      <br>
      <span>I guess I'm asking wrong when nobody has answered anything
        ...</span><br>
      <span>Apologies for not knowing how to ask.</span><br>
      <span>I have more than 90 compilations to try to know how this is
        done and I am not able to know how to do it.</span> <span>That's
        why I'm asking to see if anyone can give me a clue.</span><br>
      <br>
      <span>I want to put a progress bar centered or with a border of
        about 5 px on each side but for more than try it I do not know
        what parameters I should set to get it</span><br>
      <span>I am not able to control the width of the plugin or center
        the progress bar ...</span><br>
      <br>
      <span class="">This is the plugin code that sets the progress bar
        (only horizontal part)<br>
        <br>
        Esta es una captura de como se ve actualmente<br>
      </span></span><br>
    <a class="moz-txt-link-freetext" href="https://image.ibb.co/kNNaLG/xfce4_timer_plugin_02.png">https://image.ibb.co/kNNaLG/xfce4_timer_plugin_02.png</a><br>
    <br>
    <br>
        pd->box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);<br>
        gtk_widget_set_name (GTK_WIDGET (pd->box ),
    "xfce4-timer-plugin-v");<br>
        gtk_container_set_border_width (GTK_CONTAINER(pd->box), 0);<br>
    <br>
        gtk_container_add(GTK_CONTAINER(plugin),pd->box);<br>
        gtk_orientable_set_orientation(GTK_ORIENTABLE(pd->pbar),<br>
                                       GTK_ORIENTATION_VERTICAL);<br>
        gtk_widget_set_size_request(GTK_WIDGET(pd->pbar),0,0);<br>
        gtk_widget_set_size_request(GTK_WIDGET (plugin),0,0);<br>
    <br>
    <br>
    <br>
    //        /* Sane default Gtk style */<br>
            css_provider = gtk_css_provider_new ();<br>
            gtk_css_provider_load_from_data (css_provider,<br>
                                             "#xfce4-timer-plugin-v {"<br>
                                             "background-color: red;"<br>
                                             "}",<br>
                                             -1, NULL);<br>
            gtk_style_context_add_provider (GTK_STYLE_CONTEXT
    (gtk_widget_get_style_context (GTK_WIDGET (pd->box ))),<br>
                                            GTK_STYLE_PROVIDER
    (css_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);<br>
    <br>
        gtk_box_pack_start(GTK_BOX(pd->box),pd->pbar,TRUE,TRUE,0);<br>
    <br>
      size = xfce_panel_plugin_get_size (plugin);<br>
      gtk_widget_set_size_request (GTK_WIDGET (plugin), 1, size);<br>
    <br>
      gtk_widget_show_all(GTK_WIDGET(plugin)); <br>
    <br>
    <br>
    <pre class="moz-signature" cols="72">Dani</pre>
    <div class="moz-cite-prefix">On 06/12/17 10:47, Dani wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:9a49d7d6-6fff-bcd1-22fb-11499d4e32d8@damufo.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <tt>Hello:</tt><tt><br>
      </tt><tt><br>
        (I am</tt><tt><span id="result_box" class="" lang="en"><span
            class="alt-edited"> a novice with gtk</span></span>)<br>
        <br>
      </tt><tt><span id="result_box" class="" lang="en"><span>I wanted
            to put a progress bar on xfce4-panel.</span><br>
          <span>I do not know why the behavior is different if it goes
            horizontally or vertically.</span><br>
          <span>I am not able to focus on the widget.</span><br>
          <span>They put different background colors so that the
            position can be appreciated.</span><br>
          <span>What he wanted is:</span><br>
          <span>- Center widget.</span><br>
          <span>- Set the space to the sides (horizontal) up and down
            (vertical) so that it occupies less.</span><br>
          <br>
          <span class="">In the gtk3 documentation I did not find much
            about this.</span><br>
          <span>Any idea of where do I have to look?</span></span></tt><tt><br>
      </tt><tt><br>
      </tt><br>
      <tt><span id="result_box" class="" lang="en"><span class="">Here's
            an image of how it looks with the current code<br>
            <br>
          </span></span><a class="moz-txt-link-freetext"
          href="https://ibb.co/dcb17w" moz-do-not-send="true">https://ibb.co/dcb17w</a></tt><tt><br>
        <a class="moz-txt-link-freetext"
          href="https://image.ibb.co/n0sKub/xfce4_timer_plugin.png"
          moz-do-not-send="true">https://image.ibb.co/n0sKub/xfce4_timer_plugin.png</a><br>
      </tt><tt><br>
      </tt><br>
      <tt><span id="result_box" class="" lang="en"><span class="">The
            code is this, there are many commented parties, they are
            proof that they did not work ...<br>
            <br>
          </span></span></tt><tt>static void add_pbar(XfcePanelPlugin
        *plugin, plugin_data *pd){</tt><tt><br>
      </tt><tt><br>
      </tt><tt>  gdouble frac;</tt><tt><br>
      </tt><tt><br>
      </tt><tt>  GtkCssProvider *css_provider;</tt><tt><br>
      </tt><tt><br>
      </tt><tt>  gtk_widget_hide(GTK_WIDGET(plugin));</tt><tt><br>
      </tt><tt><br>
      </tt><tt>  /* Always true except at initialization */</tt><tt><br>
      </tt><tt>  if(pd->box){</tt><tt><br>
      </tt><tt>    g_object_ref(G_OBJECT(pd->pbar));</tt><tt><br>
      </tt><tt>   
        gtk_container_remove(GTK_CONTAINER(pd->box),pd->pbar);</tt><tt><br>
      </tt><tt>    gtk_widget_destroy(pd->box);</tt><tt><br>
      </tt><tt>  }</tt><tt><br>
      </tt><tt><br>
      </tt><tt>  if (pd -> box) {</tt><tt><br>
      </tt><tt>    frac = gtk_progress_bar_get_fraction
        (GTK_PROGRESS_BAR (pd->pbar));</tt><tt><br>
      </tt><tt>    gtk_widget_destroy(pd->box);</tt><tt><br>
      </tt><tt>    pd->pbar = gtk_progress_bar_new ();</tt><tt><br>
      </tt><tt>    //gtk_progress_bar_set_bar_style   
        (GTK_PROGRESS_BAR(pd->pbar),</tt><tt><br>
      </tt><tt>    //                GTK_PROGRESS_CONTINUOUS);</tt><tt><br>
      </tt><tt>   
        gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pd->pbar),frac);</tt><tt><br>
      </tt><tt>  }</tt><tt><br>
      </tt><tt>  </tt><tt><br>
      </tt><tt>  gtk_progress_bar_set_inverted
        (GTK_PROGRESS_BAR(pd->pbar), TRUE);</tt><tt><br>
      </tt><tt><br>
      </tt><tt><br>
      </tt><tt><br>
      </tt><tt>  /* vertical bar */</tt><tt><br>
      </tt><tt> 
if(xfce_panel_plugin_get_orientation(plugin)==GTK_ORIENTATION_HORIZONTAL){</tt><tt><br>
      </tt><tt>    pd->box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,
        0);</tt><tt><br>
      </tt><tt>    gtk_widget_set_name (GTK_WIDGET (pd->box ),
        "xfce4-timer-plugin-v");</tt><tt><br>
      </tt><tt>    //gtk_container_set_border_width
        (GTK_CONTAINER(pd->box), BORDER/2);</tt><tt><br>
      </tt><tt>    gtk_container_set_border_width
        (GTK_CONTAINER(pd->box), 0);</tt><tt><br>
      </tt><tt><br>
      </tt><tt>    gtk_container_add(GTK_CONTAINER(plugin),pd->box);</tt><tt><br>
      </tt><tt>   
        gtk_orientable_set_orientation(GTK_ORIENTABLE(pd->pbar),</tt><tt><br>
      </tt><tt>                                  
        GTK_ORIENTATION_VERTICAL);</tt><tt><br>
      </tt><tt>   
        gtk_widget_set_size_request(GTK_WIDGET(pd->pbar),PBAR_THICKNESS,0);</tt><tt><br>
      </tt><tt>    //gtk_box_pack_start(GTK_BOX(pd->box),</tt><tt><br>
      </tt><tt>    //                  
        gtk_separator_new(GTK_ORIENTATION_VERTICAL),</tt><tt><br>
      </tt><tt>    //                   FALSE, FALSE, 0);</tt><tt><br>
      </tt><tt><br>
      </tt><tt><br>
      </tt><tt><br>
      </tt><tt>        /* Sane default Gtk style */</tt><tt><br>
      </tt><tt>        css_provider = gtk_css_provider_new ();</tt><tt><br>
      </tt><tt>        gtk_css_provider_load_from_data (css_provider,</tt><tt><br>
      </tt><tt>                                        
        "#xfce4-timer-plugin-v {"</tt><tt><br>
      </tt><tt>                                        
        //"-GtkWidget-focus-padding: 0;"</tt><tt><br>
      </tt><tt>                                        
        //"-GtkWidget-focus-line-width: 0;"</tt><tt><br>
      </tt><tt>                                        
        //"-GtkButton-default-border: 0;"</tt><tt><br>
      </tt><tt>                                        
        //"-GtkButton-inner-border: 0;"</tt><tt><br>
      </tt><tt>                                        
        //"-GtkButton-background-color: red;"</tt><tt><br>
      </tt><tt>                                        
        "background-color: red;"</tt><tt><br>
      </tt><tt>                                         //"padding:
        0px;"</tt><tt><br>
      </tt><tt>                                        
        //"padding‑right: -10px;"</tt><tt><br>
      </tt><tt>                                         //"margin‑right:
        -10px;"</tt><tt><br>
      </tt><tt>                                         //"border‑right:
        -10px;"</tt><tt><br>
      </tt><tt>                                         //"width: 20px;"</tt><tt><br>
      </tt><tt>                                         "border-left:
        solid 15px blue;"</tt><tt><br>
      </tt><tt>                                         "border-right:
        solid 5px pink;"</tt><tt><br>
      </tt><tt>                                         "}",</tt><tt><br>
      </tt><tt>                                         -1, NULL);</tt><tt><br>
      </tt><tt>        gtk_style_context_add_provider (GTK_STYLE_CONTEXT
        (gtk_widget_get_style_context (GTK_WIDGET (pd->box ))),</tt><tt><br>
      </tt><tt>                                       
        GTK_STYLE_PROVIDER (css_provider),
        GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);</tt><tt><br>
      </tt><tt><br>
      </tt><tt>   
        gtk_box_pack_start(GTK_BOX(pd->box),pd->pbar,FALSE,FALSE,0);</tt><tt><br>
      </tt><tt>    //gtk_box_pack_start(GTK_BOX(pd->box),</tt><tt><br>
      </tt><tt>    //                  
        gtk_separator_new(GTK_ORIENTATION_VERTICAL),</tt><tt><br>
      </tt><tt>    //                   FALSE, FALSE, 0);</tt><tt><br>
      </tt><tt><br>
      </tt><tt><br>
      </tt><tt><br>
      </tt><tt>  }</tt><tt><br>
      </tt><tt>  else{ /* horizontal bar */</tt><tt><br>
      </tt><tt>    pd->box = gtk_box_new (GTK_ORIENTATION_VERTICAL,
        0);</tt><tt><br>
      </tt><tt>    gtk_widget_set_name (GTK_WIDGET (pd->box ),
        "xfce4-timer-plugin-h");</tt><tt><br>
      </tt><tt>    //gtk_container_set_border_width
        (GTK_CONTAINER(pd->box), BORDER/2);</tt><tt><br>
      </tt><tt>    gtk_container_set_border_width
        (GTK_CONTAINER(pd->box), BORDER/2);</tt><tt><br>
      </tt><tt>    gtk_container_add(GTK_CONTAINER(plugin),pd->box);</tt><tt><br>
      </tt><tt><br>
      </tt><tt>   
        gtk_orientable_set_orientation(GTK_ORIENTABLE(pd->pbar),</tt><tt><br>
      </tt><tt>                    GTK_ORIENTATION_HORIZONTAL);</tt><tt><br>
      </tt><tt>   
        gtk_widget_set_size_request(GTK_WIDGET(pd->pbar),0,PBAR_THICKNESS);</tt><tt><br>
      </tt><tt>    //gtk_box_pack_start(GTK_BOX(pd->box),</tt><tt><br>
      </tt><tt>    //                  
        gtk_separator_new(GTK_ORIENTATION_HORIZONTAL),</tt><tt><br>
      </tt><tt>    //                   FALSE, FALSE, 0);</tt><tt><br>
      </tt><tt><br>
      </tt><tt>    gtk_widget_set_name (GTK_WIDGET (pd->pbar ),
        "xfce4-timer-plugin-h-pbar");</tt><tt><br>
      </tt><tt>    /* Sane default Gtk style */</tt><tt><br>
      </tt><tt>    css_provider = gtk_css_provider_new ();</tt><tt><br>
      </tt><tt>    gtk_css_provider_load_from_data (css_provider,</tt><tt><br>
      </tt><tt>                                    
        "#xfce4-timer-plugin-h {"</tt><tt><br>
      </tt><tt>                                    
        //"-GtkWidget-focus-padding: 0;"</tt><tt><br>
      </tt><tt>                                    
        //"-GtkWidget-focus-line-width: 0;"</tt><tt><br>
      </tt><tt>                                    
        //"-GtkButton-default-border: 0;"</tt><tt><br>
      </tt><tt>                                    
        //"-GtkButton-inner-border: 0;"</tt><tt><br>
      </tt><tt>                                    
        //"-GtkButton-background-color: red;"</tt><tt><br>
      </tt><tt>                                     "background-color:
        green;"</tt><tt><br>
      </tt><tt>                                     //"padding: 0px;"</tt><tt><br>
      </tt><tt>                                     "padding‑right:
        20px;"</tt><tt><br>
      </tt><tt>                                     "margin‑right:
        20px;"</tt><tt><br>
      </tt><tt>                                     "border-width:
        20px;"</tt><tt><br>
      </tt><tt>                                     "border-top-color:
        rgb(128,57,0);"</tt><tt><br>
      </tt><tt>                                     "border-left-color:
        rgba(10%,20%,30%,0.5);"</tt><tt><br>
      </tt><tt>                                     "border-right-color:
        #ff00cc;"</tt><tt><br>
      </tt><tt>                                    
        "border-bottom-color: #ffff0000cccc;} 
        #xfce4-timer-plugin-h-pbar {border: solid 5px pink;}",</tt><tt><br>
      </tt><tt>                                     -1, NULL);</tt><tt><br>
      </tt><tt>    gtk_style_context_add_provider (GTK_STYLE_CONTEXT
        (gtk_widget_get_style_context (GTK_WIDGET (pd->box ))),</tt><tt><br>
      </tt><tt>                                    GTK_STYLE_PROVIDER
        (css_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);</tt><tt><br>
      </tt><tt><br>
      </tt><tt>   
        gtk_box_pack_start(GTK_BOX(pd->box),pd->pbar,FALSE,FALSE,0);</tt><tt><br>
      </tt><tt>    //gtk_box_pack_start(GTK_BOX(pd->box),</tt><tt><br>
      </tt><tt>    //                  
        gtk_separator_new(GTK_ORIENTATION_HORIZONTAL),</tt><tt><br>
      </tt><tt>    //                   FALSE, FALSE, 0);</tt><tt><br>
      </tt><tt><br>
      </tt><tt>  }</tt><tt><br>
      </tt><tt><br>
      </tt><tt><br>
      </tt><tt>  gtk_widget_show_all(GTK_WIDGET(plugin)); </tt><tt><br>
      </tt><tt><br>
      </tt><tt>}</tt><tt><br>
      </tt><tt><br>
        <br>
        Very thanks<br>
      </tt><tt><br>
      </tt>
      <pre class="moz-signature" cols="72">-- 
Dani</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Xfce4-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Xfce4-dev@xfce.org">Xfce4-dev@xfce.org</a>
<a class="moz-txt-link-freetext" href="https://mail.xfce.org/mailman/listinfo/xfce4-dev">https://mail.xfce.org/mailman/listinfo/xfce4-dev</a></pre>
    </blockquote>
    <br>
  </body>
</html>