@@ -19,7 +19,7 @@ greeter_menu_bar_init(GreeterMenuBar* square)
1919}
2020
2121GtkWidget *
22- greeter_menu_bar_new ()
22+ greeter_menu_bar_new (void )
2323{
2424 return GTK_WIDGET (g_object_new (greeter_menu_bar_get_type (), NULL ));
2525}
@@ -35,17 +35,19 @@ sort_minimal_size(gconstpointer a, gconstpointer b, GtkRequestedSize* sizes)
3535static void
3636greeter_menu_bar_size_allocate (GtkWidget * widget , GtkAllocation * allocation )
3737{
38- GList * item ;
39- GList * shell_children ;
40- GList * expand_nums = NULL ;
41- guint visible_count = 0 , expand_count = 0 ;
38+ GtkPackDirection pack_direction ;
39+ GList * item ;
40+ GList * shell_children ;
41+ GList * expand_nums = NULL ;
42+ guint visible_count = 0 ;
43+ guint expand_count = 0 ;
4244
4345 g_return_if_fail (allocation != NULL );
4446 g_return_if_fail (GREETER_IS_MENU_BAR (widget ));
4547
4648 gtk_widget_set_allocation (widget , allocation );
4749
48- GtkPackDirection pack_direction = gtk_menu_bar_get_pack_direction (GTK_MENU_BAR (widget ));
50+ pack_direction = gtk_menu_bar_get_pack_direction (GTK_MENU_BAR (widget ));
4951 g_return_if_fail (pack_direction == GTK_PACK_DIRECTION_LTR || pack_direction == GTK_PACK_DIRECTION_RTL );
5052
5153 shell_children = gtk_container_get_children (GTK_CONTAINER (widget ));
@@ -76,6 +78,9 @@ greeter_menu_bar_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
7678 GtkShadowType shadow_type = GTK_SHADOW_OUT ;
7779 GtkBorder border ;
7880 gint toggle_size ;
81+ GtkRequestedSize * request ;
82+ gboolean ltr ;
83+ int size ;
7984
8085 gtk_style_context_get_padding (context , flags , & border );
8186 gtk_widget_style_get (widget , "shadow-type" , & shadow_type , NULL );
@@ -97,9 +102,9 @@ greeter_menu_bar_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
97102 remaining_space .height -= border .top + border .bottom ;
98103 }
99104
100- GtkRequestedSize * request = requested_sizes ;
101- int size = remaining_space .width ;
102- gboolean ltr = (gtk_widget_get_direction (widget ) == GTK_TEXT_DIR_LTR ) == (pack_direction == GTK_PACK_DIRECTION_LTR );
105+ request = requested_sizes ;
106+ size = remaining_space .width ;
107+ ltr = (gtk_widget_get_direction (widget ) == GTK_TEXT_DIR_LTR ) == (pack_direction == GTK_PACK_DIRECTION_LTR );
103108
104109 for (item = shell_children ; item ; item = g_list_next (item ))
105110 {
@@ -126,13 +131,15 @@ greeter_menu_bar_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
126131 /* Distribution extra space for widgets with expand=True */
127132 if (size > 0 && expand_nums )
128133 {
134+ GList * first_item = NULL ;
135+ gint needed_size = -1 ;
136+ gint max_size = 0 ;
137+ gint total_needed_size = 0 ;
138+
129139 expand_nums = g_list_sort_with_data (expand_nums , (GCompareDataFunc )sort_minimal_size ,
130140 requested_sizes );
131- GList * first_item = expand_nums ;
132- gint needed_size = -1 ;
133- gint max_size = requested_sizes [GPOINTER_TO_INT (first_item -> data )].natural_size ;
134- gint total_needed_size = 0 ;
135-
141+ first_item = expand_nums ;
142+ max_size = requested_sizes [GPOINTER_TO_INT (first_item -> data )].natural_size ;
136143
137144 /* Free space that all widgets need to have the same (max_size) width
138145 * [___max_width___][widget ][widget____ ]
@@ -159,17 +166,19 @@ greeter_menu_bar_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
159166
160167 for (item = first_item ; item ; item = g_list_next (item ))
161168 {
169+ gint dsize = 0 ;
170+
162171 request = & requested_sizes [GPOINTER_TO_INT (item -> data )];
163- gint dsize = needed_size - request -> natural_size ;
172+ dsize = needed_size - request -> natural_size ;
164173 if (size < dsize )
165174 dsize = size ;
166175 size -= dsize ;
167176 request -> natural_size += dsize ;
168177 }
169178 }
170179
171- gint i ;
172- for (i = 0 ; i < visible_count ; i ++ )
180+
181+ for (guint i = 0 ; i < visible_count ; i ++ )
173182 {
174183 GtkAllocation child_allocation = remaining_space ;
175184 request = & requested_sizes [i ];
0 commit comments