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