File: bibledit-bibletime.h

package info (click to toggle)
bibledit-bibletime 1.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 652 kB
  • sloc: sh: 3,316; cpp: 847; xml: 275; makefile: 36
file content (175 lines) | stat: -rw-r--r-- 4,965 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
** Copyright (©) 2003-2008 Teus Benschop.
**  
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 3 of the License, or
** (at your option) any later version.
**  
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**  
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc.,  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
**  
*/


#ifndef INCLUDED_BIBLEDIT_BIBLETIME_H
#define INCLUDED_BIBLEDIT_BIBLETIME_H


#include <cstdlib>
#include <unistd.h>
#include <fcntl.h>
#include <gtk/gtk.h>
#include <string>
#include <iostream>
#include <vector>
#include <fstream>
#include <sstream>
#include <exception>
#include <stdexcept>
#include <set>
#include <deque>
#include <libsoup/soup.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>


using namespace std;


GtkWidget * window;

GtkWidget * entry_url;
static void on_entry_url_changed(GtkEditable * editable, gpointer user_data);

GtkWidget * button_url;
static void on_button_url_clicked(GtkButton * button, gpointer user_data);

GtkWidget * label_url;

GtkWidget * entry_user;
static void on_entry_user_changed(GtkEditable * editable, gpointer user_data);

GtkWidget * label_bibletime_process;

GtkWidget * label_id;
string last_message_id;
GtkWidget * label_command;
GtkWidget * label_body;

GtkWidget * label_bibletime;

GtkWidget * button_hide;
static void on_button_hide_clicked(GtkButton * button, gpointer user_data);

gchar * registry_file_name ();


class TinySpawn
{
public:
  TinySpawn (const char * program);
  ~TinySpawn ();
  void workingdirectory (string directory);
  void arg (string value);
  void read ();
  void run ();
  bool result;
  gint exitstatus;
  vector <string> standardout;
  vector <string> standarderr;
private:
  const char * myprogram;
  string myworkingdirectory;
  bool myread;
  vector <string> arguments;
};


class ParseLine
{
public:
  ParseLine (const string & text);
  ~ParseLine ();
  vector <string> lines;
private:
};


class Parse
{
public:
  Parse (const string & line, bool remove_punctuation = true, const string& separator = " ");
  ~Parse ();
  vector <string> words;
private:
};



int main (int argc, char *argv[]);
void message (string message);
string trim(const string & s);
string convert_to_string(int i);
string convert_to_string(unsigned int i);
string convert_to_string(bool b);
string convert_to_string(double d);
string convert_to_string(long unsigned int i);


static SoupSession *session;

static void start_bibletime_web_listener ();
static void on_bibletime_web_listener_ready_callback (SoupSession *session, SoupMessage *msg, gpointer user_data);

static DBusConnection *con;
static DBusGConnection *sigcon;
static DBusGProxy *proxy;
static void on_name_acquired (DBusGProxy *proxy, const char *name, gpointer user_data);
static void on_name_owner_changed (DBusGProxy *proxy, const char *name, const char *prev, const char *nw, gpointer user_data);
static void on_name_lost (DBusGProxy *proxy, const char *name, gpointer user_data);

static guint event_id_rescan_bus;
static int message_type;
static vector <string> string_reply;
static string bibletime_bus_name;
static const gchar * bibletime_dbus_object ();
static const gchar * bibletime_dbus_interface ();
void send_to_bibletime (const gchar * object, const gchar * interface, const gchar * method, const string& value);
vector <string> receive_from_bibletime (const gchar * object, const gchar * interface, const gchar * method);
void send_to_xiphos (const gchar * object, const gchar * interface, const gchar * method, const string& value);
void send (const gchar * bus_name, const gchar * object, const gchar * interface, const gchar * method, const string& payload);
vector <string> method_call_wait_reply (const gchar * bus_name, const gchar * object, const gchar * interface, const gchar * method, bool silent);
void retrieve_message (DBusMessage *message);
void retrieve_iter (DBusMessageIter *iter);
void names_on_dbus_changed ();
static bool on_rescan_bus_timeout(gpointer user_data);
void on_rescan_bus();

static void destroy_source(guint & event_id);

void send_response_to_bibledit (const string& subject, const string& identifier, const string& message);
static void on_message_ready_callback (SoupSession *session, SoupMessage *msg, gpointer user_data);

static void sigproc(int dummy);
static void sigquit(int dummy);
bool quit;
static void program_quit ();
int main (int argc, char **argv);


int convert_to_int(const string & str);


// Aids for dbus: dbus-monitor, d-feet



#endif