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