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
00163
00164 static GType get_base_type() G_GNUC_CONST;
00165 #endif
00166
00168 GnomeClient* gobj() { return reinterpret_cast<GnomeClient*>(gobject_); }
00169
00171 const GnomeClient* gobj() const { return reinterpret_cast<GnomeClient*>(gobject_); }
00172
00173
00174 public:
00175
00176 #ifdef GLIBMM_VFUNCS_ENABLED
00177 #endif //GLIBMM_VFUNCS_ENABLED
00178
00179 protected:
00180
00181 #ifdef GLIBMM_VFUNCS_ENABLED
00182 #endif //GLIBMM_VFUNCS_ENABLED
00183
00184
00185 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00186 virtual bool on_save_yourself(int phase, SaveStyle save_style, bool shutdown, InteractStyle interact_style, bool fast);
00187 virtual void on_die();
00188 virtual void on_save_complete();
00189 virtual void on_shutdown_cancelled();
00190 virtual void on_connect(bool restarted);
00191 virtual void on_disconnect();
00192 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00193
00194
00195 private:
00196
00197 public:
00198
00199 Client(bool connect_to_session_manager = true);
00200
00201
00202 static Client* master_client();
00203
00204 Glib::ustring get_config_prefix();
00205
00206 Glib::ustring get_global_config_prefix();
00207
00208 void set_global_config_prefix(const Glib::ustring& prefix);
00209
00210 GnomeClientFlags get_flags();
00211
00212 void set_restart_style(GnomeRestartStyle style);
00213
00214 void set_priority(guint priority);
00215
00216
00217
00218
00219 void set_restart_command(gint argc, char** argv);
00220 void set_restart_command(const Glib::ArrayHandle<Glib::ustring>& argv);
00221
00222
00223
00224
00225
00226 void set_discard_command(gint argc, char** argv);
00227 void set_discard_command(const Glib::ArrayHandle<Glib::ustring>& argv);
00228
00229
00230 void set_resign_command(gint argc, char** argv);
00231 void set_resign_command(const Glib::ArrayHandle<Glib::ustring>& argv);
00232
00233
00234 void set_shutdown_command(gint argc, char** argv);
00235 void set_shutdown_command(const Glib::ArrayHandle<Glib::ustring>& argv);
00236
00237
00238 void set_current_directory(const Glib::ustring& dir);
00239
00240 void set_environment(const Glib::ustring& name, const Glib::ustring& value);
00241
00242
00243 void set_clone_command(gint argc, char** argv);
00244 void set_clone_command(const Glib::ArrayHandle<Glib::ustring>& argv);
00245
00246
00247 void set_process_id(pid_t pid);
00248
00249 void set_program(const Glib::ustring& program);
00250
00251 void set_user_id(const Glib::ustring& user_id);
00252
00253
00254 void save_any_dialog(Gtk::Dialog& dialog);
00255
00256 void save_error_dialog(Gtk::Dialog& dialog);
00257
00258 void request_phase_2();
00259
00260 void request_save(SaveStyle save_style, bool shutdown, InteractStyle interact_style, bool fast, bool global);
00261
00262 void flush();
00263
00264
00265
00266
00267
00268
00269 void connect_to_session_manager();
00270 bool is_connected();
00271
00272 void disconnect();
00273
00274
00275 void set_id(const Glib::ustring& client_id);
00276
00277 Glib::ustring get_id() const;
00278
00279 Glib::ustring get_previous_id() const;
00280
00281 Glib::ustring get_desktop_id() const;
00282
00283
00284
00285 void request_interaction(GnomeDialogType dialog, GnomeInteractFunction func, gpointer client_data);
00286
00287
00288 static void gnome_interaction_key_return(gint key, bool cancel_shutdown);
00289
00290
00296 Glib::SignalProxy5< bool,int,SaveStyle,bool,InteractStyle,bool > signal_save_yourself();
00297
00298
00304 Glib::SignalProxy0< void > signal_die();
00305
00306
00312 Glib::SignalProxy0< void > signal_save_complete();
00313
00314
00320 Glib::SignalProxy0< void > signal_shutdown_cancelled();
00321
00322
00328 Glib::SignalProxy1< void,bool > signal_connect();
00329
00330
00336 Glib::SignalProxy0< void > signal_disconnect();
00337
00338
00339 };
00340
00341 }
00342 }
00343
00344
00345 namespace Glib
00346 {
00355 Gnome::UI::Client* wrap(GnomeClient* object, bool take_copy = false);
00356 }
00357
00358
00359 #endif
00360