~ubuntu-branches/ubuntu/trusty/evince/trusty-proposed

« back to all changes in this revision

Viewing changes to shell/main.c

Tags: upstream-0.7.0
ImportĀ upstreamĀ versionĀ 0.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 *  along with this program; if not, write to the Free Software
16
16
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
17
 *
18
 
 *  $Id: main.c,v 1.38 2006/08/21 18:46:48 carlosgc Exp $
19
18
 */
20
19
 
21
20
#include "config.h"
47
46
static gboolean preview_mode = FALSE;
48
47
static gboolean fullscren_mode = FALSE;
49
48
static gboolean presentation_mode = FALSE;
 
49
static gboolean unlink_temp_file = FALSE;
50
50
static const char **file_arguments = NULL;
51
51
 
52
52
static const GOptionEntry goption_options[] =
55
55
        { "fullscreen", 'f', 0, G_OPTION_ARG_NONE, &fullscren_mode, N_("Run evince in fullscreen mode"), NULL },
56
56
        { "presentation", 's', 0, G_OPTION_ARG_NONE, &presentation_mode, N_("Run evince in presentation mode"), NULL },
57
57
        { "preview", 'w', 0, G_OPTION_ARG_NONE, &preview_mode, N_("Run evince as a previewer"), NULL },
 
58
        { "unlink-temp-file", 'u', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &unlink_temp_file, NULL, NULL },
58
59
        { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &file_arguments, NULL, N_("[FILE...]") },
59
60
        { NULL }
60
61
};
72
73
        GHashTable      *args;
73
74
        GValue          *value;
74
75
        EvWindowRunMode  mode;
 
76
        GdkScreen       *screen;
 
77
        GdkDisplay      *display;
 
78
        const gchar     *display_name;
 
79
        gint             screen_number;
75
80
 
76
81
        args = g_hash_table_new_full (g_str_hash,
77
82
                                      g_str_equal,
78
83
                                      (GDestroyNotify)g_free,
79
84
                                      (GDestroyNotify)value_free);
 
85
        
 
86
        screen = gdk_screen_get_default ();
 
87
        display = gdk_screen_get_display (screen);
 
88
 
 
89
        display_name = gdk_display_get_name (display);
 
90
        screen_number = gdk_screen_get_number (screen);
 
91
 
 
92
        value = g_new0 (GValue, 1);
 
93
        g_value_init (value, G_TYPE_STRING);
 
94
        g_value_set_string (value, display_name);
 
95
        g_hash_table_insert (args, g_strdup ("display"), value);
 
96
 
 
97
        value = g_new0 (GValue, 1);
 
98
        g_value_init (value, G_TYPE_INT);
 
99
        g_value_set_int (value, screen_number);
 
100
        g_hash_table_insert (args, g_strdup ("screen"), value);
80
101
 
81
102
        if (ev_page_label) {
82
103
                value = g_new0 (GValue, 1);
101
122
 
102
123
        g_hash_table_insert (args, g_strdup ("mode"), value);
103
124
 
 
125
        if (mode == EV_WINDOW_MODE_PREVIEW && unlink_temp_file) {
 
126
                value = g_new0 (GValue, 1);
 
127
                g_value_init (value, G_TYPE_BOOLEAN);
 
128
                g_value_set_boolean (value, unlink_temp_file);
 
129
 
 
130
                g_hash_table_insert (args,
 
131
                                     g_strdup ("unlink-temp-file"),
 
132
                                     value);
 
133
        }
 
134
 
104
135
        return args;
105
136
}
106
137
 
111
142
        int i;
112
143
 
113
144
        if (!files) {
114
 
                ev_application_open_window (EV_APP, GDK_CURRENT_TIME, NULL);
 
145
                ev_application_open_window (EV_APP, args, GDK_CURRENT_TIME, NULL);
115
146
                return;
116
147
        }
117
148
 
166
197
        GdkDisplay *display;
167
198
        guint32 timestamp;
168
199
 
169
 
        display = gdk_display_get_default();
 
200
        display = gdk_display_get_default ();
170
201
        timestamp = gdk_x11_display_get_user_time (display);
171
202
        connection = dbus_g_bus_get (DBUS_BUS_STARTER, &error);
172
203
 
208
239
                }
209
240
#else
210
241
                if (!dbus_g_proxy_call (remote_object, "OpenWindow", &error,
 
242
                                        dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), args,
211
243
                                        G_TYPE_UINT, timestamp,
212
244
                                        G_TYPE_INVALID,
213
245
                                        G_TYPE_INVALID)) {