00001
00002
00003 #ifndef _LIBGNOMEUIMM_CLIENT_H
00004 #define _LIBGNOMEUIMM_CLIENT_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include <glibmm/arrayhandle.h>
00032 #include <gtkmm/dialog.h>
00033 #include <libgnomeui/gnome-client.h>
00034
00035
00036 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00037 typedef struct _GnomeClient GnomeClient;
00038 typedef struct _GnomeClientClass GnomeClientClass;
00039 #endif
00040
00041
00042 namespace Gnome
00043 {
00044
00045 namespace UI
00046 { class Client_Class; }
00047
00048 }
00049 namespace Gnome
00050 {
00051
00052 namespace UI
00053 {
00054
00055
00061 enum SaveStyle
00062 {
00063 SAVE_GLOBAL,
00064 SAVE_LOCAL,
00065 SAVE_BOTH
00066 };
00067
00068 }
00069
00070 }
00071
00072
00073 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00074 namespace Glib
00075 {
00076
00077 template <>
00078 class Value<Gnome::UI::SaveStyle> : public Glib::Value_Enum<Gnome::UI::SaveStyle>
00079 {
00080 public:
00081 static GType value_type() G_GNUC_CONST;
00082 };
00083
00084 }
00085 #endif
00086
00087
00088 namespace Gnome
00089 {
00090
00091 namespace UI
00092 {
00093
00097 enum InteractStyle
00098 {
00099 INTERACT_NONE,
00100 INTERACT_ERRORS,
00101 INTERACT_ANY
00102 };
00103
00104 }
00105
00106 }
00107
00108
00109 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00110 namespace Glib
00111 {
00112
00113 template <>
00114 class Value<Gnome::UI::InteractStyle> : public Glib::Value_Enum<Gnome::UI::InteractStyle>
00115 {
00116 public:
00117 static GType value_type() G_GNUC_CONST;
00118 };
00119
00120 }
00121 #endif
00122
00123
00124 namespace Gnome
00125 {
00126
00127 namespace UI
00128 {
00129
00130
00131 class Client : public Gtk::Object
00132 {
00133 public:
00134 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00135 typedef Client CppObjectType;
00136 typedef Client_Class CppClassType;
00137 typedef GnomeClient BaseObjectType;
00138 typedef GnomeClientClass BaseClassType;
00139 #endif
00140
00141 virtual ~Client();
00142
00143 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00144
00145 private:
00146 friend class Client_Class;
00147 static CppClassType client_class_;
00148
00149
00150 Client(const Client&);
00151 Client& operator=(const Client&);
00152
00153 protected:
00154 explicit Client(const Glib::ConstructParams& construct_params);
00155 explicit Client(GnomeClient* castitem);
00156
00157 #endif
00158
00159 public:
00160 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00161 static GType get_type() G_GNUC_CONST;
00162 static GType get_base_type() G_GNUC_CONST;
00163 #endif
00164
00166 GnomeClient* gobj() { return reinterpret_cast<GnomeClient*>(gobject_); }
00167
00169 const GnomeClient* gobj() const { return reinterpret_cast<GnomeClient*>(gobject_); }
00170
00171
00172 public:
00173
00174
00175 protected:
00176
00177
00178
00179 virtual bool on_save_yourself(int phase, SaveStyle save_style, bool shutdown, InteractStyle interact_style, bool fast);
00180 virtual void on_die();
00181 virtual void on_save_complete();
00182 virtual void on_shutdown_cancelled();
00183 virtual void on_connect(bool restarted);
00184 virtual void on_disconnect();
00185
00186
00187 private:
00188
00189 public:
00190
00191 Client(bool connect_to_session_manager = true);
00192
00193
00194 static Client* master_client();
00195
00196 Glib::ustring get_config_prefix();
00197
00198 Glib::ustring get_global_config_prefix();
00199
00200 void set_global_config_prefix(const Glib::ustring& prefix);
00201
00202 GnomeClientFlags get_flags();
00203
00204 void set_restart_style(GnomeRestartStyle style);
00205
00206 void set_priority(guint priority);
00207
00208
00209
00210
00211 void set_restart_command(gint argc, char** argv);
00212 void set_restart_command(const Glib::ArrayHandle<Glib::ustring>& argv);
00213
00214
00215
00216
00217
00218 void set_discard_command(gint argc, char** argv);
00219 void set_discard_command(const Glib::ArrayHandle<Glib::ustring>& argv);
00220
00221
00222 void set_resign_command(gint argc, char** argv);
00223 void set_resign_command(const Glib::ArrayHandle<Glib::ustring>& argv);
00224
00225
00226 void set_shutdown_command(gint argc, char** argv);
00227 void set_shutdown_command(const Glib::ArrayHandle<Glib::ustring>& argv);
00228
00229
00230 void set_current_directory(const Glib::ustring& dir);
00231
00232 void set_environment(const Glib::ustring& name, const Glib::ustring& value);
00233
00234
00235 void set_clone_command(gint argc, char** argv);
00236 void set_clone_command(const Glib::ArrayHandle<Glib::ustring>& argv);
00237
00238
00239 void set_process_id(pid_t pid);
00240
00241 void set_program(const Glib::ustring& program);
00242
00243 void set_user_id(const Glib::ustring& user_id);
00244
00245
00246 void save_any_dialog(Gtk::Dialog& dialog);
00247
00248 void save_error_dialog(Gtk::Dialog& dialog);
00249
00250 void request_phase_2();
00251
00252 void request_save(SaveStyle save_style, bool shutdown, InteractStyle interact_style, bool fast, bool global);
00253
00254 void flush();
00255
00256
00257
00258
00259
00260
00261 void connect_to_session_manager();
00262 bool is_connected();
00263
00264 void disconnect();
00265
00266
00267 void set_id(const Glib::ustring& client_id);
00268
00269 Glib::ustring get_id() const;
00270
00271 Glib::ustring get_previous_id() const;
00272
00273 Glib::ustring get_desktop_id() const;
00274
00275
00276
00277 void request_interaction(GnomeDialogType dialog, GnomeInteractFunction func, gpointer client_data);
00278
00279
00280 static void gnome_interaction_key_return(gint key, bool cancel_shutdown);
00281
00282
00283 Glib::SignalProxy5< bool,int,SaveStyle,bool,InteractStyle,bool > signal_save_yourself();
00284
00285
00286 Glib::SignalProxy0< void > signal_die();
00287
00288
00289 Glib::SignalProxy0< void > signal_save_complete();
00290
00291
00292 Glib::SignalProxy0< void > signal_shutdown_cancelled();
00293
00294
00295 Glib::SignalProxy1< void,bool > signal_connect();
00296
00297
00298 Glib::SignalProxy0< void > signal_disconnect();
00299
00300
00301 };
00302
00303 }
00304 }
00305
00306
00307 namespace Glib
00308 {
00314 Gnome::UI::Client* wrap(GnomeClient* object, bool take_copy = false);
00315 }
00316
00317
00318 #endif
00319