~kalgasnik/lightdm-gtk-greeter/new_panel_layout

« back to all changes in this revision

Viewing changes to src/greetermenubar.c

  • Committer: Andrew P.
  • Date: 2014-05-13 22:52:42 UTC
  • Revision ID: pan.pav.7c5@gmail.com-20140513225242-pzf5usjhqg77gjx6
GTK2 compatability

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <gtk/gtk.h>
2
2
#include "greetermenubar.h"
3
3
 
4
 
/* Forward declarations */
 
4
#if GTK_CHECK_VERSION (3, 0, 0)
5
5
static void greeter_menu_bar_size_allocate(GtkWidget* widget, GtkAllocation* allocation);
 
6
#endif
6
7
 
7
8
G_DEFINE_TYPE(GreeterMenuBar, greeter_menu_bar, GTK_TYPE_MENU_BAR);
8
9
 
9
 
 
10
10
static void
11
11
greeter_menu_bar_class_init(GreeterMenuBarClass* klass)
12
12
{
 
13
    #if GTK_CHECK_VERSION (3, 0, 0)
13
14
        GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass);
14
15
        widget_class->size_allocate = greeter_menu_bar_size_allocate;
 
16
        #endif
15
17
}
16
18
 
17
19
static void
26
28
        return GTK_WIDGET(g_object_new(greeter_menu_bar_get_type(), NULL));
27
29
}
28
30
 
29
 
static GtkShadowType
30
 
get_shadow_type(GtkWidget* widget)
31
 
{
32
 
    GtkShadowType shadow_type = GTK_SHADOW_OUT;
33
 
    gtk_widget_style_get(widget, "shadow-type", &shadow_type, NULL);
34
 
    return shadow_type;
35
 
}
36
 
 
 
31
#if GTK_CHECK_VERSION (3, 0, 0)
37
32
static gint
38
33
sort_minimal_size(gconstpointer a, gconstpointer b, GtkRequestedSize* sizes)
39
34
{
89
84
        GtkRequestedSize* requested_sizes = g_newa(GtkRequestedSize, visible_count);
90
85
        guint border_width = gtk_container_get_border_width(GTK_CONTAINER(widget));
91
86
        GtkBorder border;
 
87
        GtkShadowType shadow_type = GTK_SHADOW_OUT;
92
88
 
93
89
        gtk_style_context_get_padding(context, flags, &border);
 
90
        gtk_widget_style_get(widget, "shadow-type", &shadow_type, NULL);
94
91
 
95
92
        remaining_space.x = (border_width + border.left);
96
93
        remaining_space.y = (border_width + border.top);
99
96
        remaining_space.height = allocation->height -
100
97
                                 2 * border_width - border.top - border.bottom;
101
98
 
102
 
        if (get_shadow_type(widget) != GTK_SHADOW_NONE)
 
99
        if (shadow_type != GTK_SHADOW_NONE)
103
100
        {
104
101
            gtk_style_context_get_border(context, flags, &border);
105
102
 
189
186
    }
190
187
    g_list_free(shell_children);
191
188
}
 
189
#endif
 
 
b'\\ No newline at end of file'