Skip to content

Commit 532995c

Browse files
committed
Remove all #if 0...#endif and some other dead code
This should be a complete no-op code wise. Nothing in this commit should change the function of the program in any way. If `git bisect` or similar ever traces a problem to this commit, then something is wrong and I didn't match start/end markers properly. This partially addresses issue #894, bullet point 1 & part of 2.
1 parent f965eae commit 532995c

26 files changed

+4
-1256
lines changed

src/editor/slib-editor.c

-177
Original file line numberDiff line numberDiff line change
@@ -102,173 +102,6 @@ static void change_window_title(GtkWidget *window, const gchar *window_title)
102102
gtk_window_set_title(GTK_WINDOW(window), window_title);
103103
}
104104

105-
#if 0
106-
static gint
107-
_calc_header_height(GtkHTML * html, GtkPrintOperation * operation,
108-
GtkPrintContext * context)
109-
{
110-
PangoContext *pango_context;
111-
PangoFontDescription *desc;
112-
PangoFontMetrics *metrics;
113-
gint header_height;
114-
115-
pango_context = gtk_print_context_create_pango_context(context);
116-
desc = pango_font_description_from_string("Sans Regular 10");
117-
118-
metrics =
119-
pango_context_get_metrics(pango_context, desc,
120-
pango_language_get_default());
121-
header_height =
122-
pango_font_metrics_get_ascent(metrics) +
123-
pango_font_metrics_get_descent(metrics);
124-
pango_font_metrics_unref(metrics);
125-
126-
pango_font_description_free(desc);
127-
g_object_unref(pango_context);
128-
129-
return header_height;
130-
}
131-
132-
static gint
133-
_calc_footer_height(GtkHTML * html, GtkPrintOperation * operation,
134-
GtkPrintContext * context)
135-
{
136-
PangoContext *pango_context;
137-
PangoFontDescription *desc;
138-
PangoFontMetrics *metrics;
139-
gint footer_height;
140-
141-
pango_context = gtk_print_context_create_pango_context(context);
142-
desc = pango_font_description_from_string("Sans Regular 10");
143-
144-
metrics =
145-
pango_context_get_metrics(pango_context, desc,
146-
pango_language_get_default());
147-
footer_height =
148-
pango_font_metrics_get_ascent(metrics) +
149-
pango_font_metrics_get_descent(metrics);
150-
pango_font_metrics_unref(metrics);
151-
152-
pango_font_description_free(desc);
153-
g_object_unref(pango_context);
154-
155-
return footer_height;
156-
}
157-
158-
static void
159-
_draw_header(GtkHTML * html, GtkPrintOperation * operation,
160-
GtkPrintContext * context,
161-
gint page_nr, PangoRectangle * rec, EDITOR * e)
162-
{
163-
PangoFontDescription *desc;
164-
PangoLayout *layout;
165-
gdouble x, y;
166-
gchar *text;
167-
cairo_t *cr;
168-
169-
text = g_strdup(e->filename);
170-
171-
desc = pango_font_description_from_string("Sans Regular 10");
172-
layout = gtk_print_context_create_pango_layout(context);
173-
pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
174-
pango_layout_set_font_description(layout, desc);
175-
pango_layout_set_text(layout, text, -1);
176-
pango_layout_set_width(layout, rec->width);
177-
178-
x = pango_units_to_double(rec->x);
179-
y = pango_units_to_double(rec->y);
180-
181-
cr = gtk_print_context_get_cairo_context(context);
182-
183-
cairo_save(cr);
184-
cairo_set_source_rgb(cr, .0, .0, .0);
185-
cairo_move_to(cr, x, y);
186-
pango_cairo_show_layout(cr, layout);
187-
cairo_restore(cr);
188-
189-
g_object_unref(layout);
190-
pango_font_description_free(desc);
191-
192-
g_free(text);
193-
}
194-
195-
196-
static void
197-
_draw_footer(GtkHTML * html, GtkPrintOperation * operation,
198-
GtkPrintContext * context,
199-
gint page_nr, PangoRectangle * rec, EDITOR * e)
200-
{
201-
PangoFontDescription *desc;
202-
PangoLayout *layout;
203-
gdouble x, y;
204-
gint n_pages;
205-
gchar *text;
206-
cairo_t *cr;
207-
208-
g_object_get(operation, "n-pages", &n_pages, NULL);
209-
text = g_strdup_printf(_("Page %d of %d"), page_nr + 1, n_pages);
210-
211-
desc = pango_font_description_from_string("Sans Regular 10");
212-
layout = gtk_print_context_create_pango_layout(context);
213-
pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
214-
pango_layout_set_font_description(layout, desc);
215-
pango_layout_set_text(layout, text, -1);
216-
pango_layout_set_width(layout, rec->width);
217-
218-
x = pango_units_to_double(rec->x);
219-
y = pango_units_to_double(rec->y);
220-
221-
cr = gtk_print_context_get_cairo_context(context);
222-
223-
cairo_save(cr);
224-
cairo_set_source_rgb(cr, .0, .0, .0);
225-
cairo_move_to(cr, x, y);
226-
pango_cairo_show_layout(cr, layout);
227-
cairo_restore(cr);
228-
229-
g_object_unref(layout);
230-
pango_font_description_free(desc);
231-
232-
g_free(text);
233-
}
234-
235-
static GtkPrintOperationResult
236-
_do_print(EDITOR * e, GtkPrintOperationAction action)
237-
{
238-
GtkPrintOperation *operation;
239-
GtkPrintSettings *psettings;
240-
GtkPageSetup *setup;
241-
GtkPrintOperationResult result;
242-
GError *error = NULL;
243-
244-
operation = gtk_print_operation_new();
245-
psettings = gtk_print_settings_new();
246-
247-
psettings = gtk_print_operation_get_print_settings(operation);
248-
249-
setup = gtk_page_setup_new();
250-
gtk_page_setup_set_top_margin(setup, 30, GTK_UNIT_PIXEL);
251-
gtk_page_setup_set_left_margin(setup, 50, GTK_UNIT_PIXEL);
252-
253-
#ifdef WIN32
254-
gtk_print_operation_set_unit(operation, GTK_UNIT_POINTS);
255-
#endif
256-
gtk_print_operation_set_default_page_setup(operation, setup);
257-
258-
result = gtk_html_print_operation_run(GTK_HTML(e->html_widget), operation, action, GTK_WINDOW(e->window), (GtkHTMLPrintCalcHeight) _calc_header_height, /* GtkHTMLPrintCalcHeight calc_header_height */
259-
(GtkHTMLPrintCalcHeight) _calc_footer_height, /* GtkHTMLPrintCalcHeight calc_footer_height */
260-
(GtkHTMLPrintDrawFunc) _draw_header, /* GtkHTMLPrintDrawFunc draw_header */
261-
(GtkHTMLPrintDrawFunc) _draw_footer, /* GtkHTMLPrintDrawFunc draw_footer */
262-
e, /* gpointer user_data */
263-
&error);
264-
265-
g_object_unref(operation);
266-
handle_error(&error);
267-
268-
return result;
269-
}
270-
#endif /* 0 */
271-
272105
static const gchar *file_ui =
273106
"<ui>\n"
274107
" <menubar name='main-menu'>\n"
@@ -360,9 +193,6 @@ static gint open_dialog(EDITOR *e)
360193
{
361194
GtkWidget *dialog;
362195
gint response;
363-
#if 0
364-
const gchar *filename;
365-
#endif
366196

367197
dialog =
368198
gtk_file_chooser_dialog_new(_("Open"), GTK_WINDOW(e->window),
@@ -378,13 +208,6 @@ static gint open_dialog(EDITOR *e)
378208
#endif
379209
NULL);
380210

381-
/*gtk_file_chooser_set_do_overwrite_confirmation (
382-
GTK_FILE_CHOOSER (dialog), TRUE); */
383-
384-
#if 0
385-
filename = gtkhtml_editor_get_filename(GTKHTML_EDITOR(e->window));
386-
#endif
387-
388211
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
389212
settings.studypaddir);
390213

src/gtk/bibletext.c

-25
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,6 @@ gboolean shift_key_pressed = FALSE;
5656
guint scroll_adj_signal;
5757
GtkAdjustment *adjustment;
5858

59-
#if 0
60-
// unneeded at this time. disabled to silence cppcheck.
61-
/******************************************************************************
62-
* Name
63-
*
64-
*
65-
* Synopsis
66-
* #include "gui/.h"
67-
*
68-
*
69-
*
70-
* Description
71-
*
72-
*
73-
* Return value
74-
* void
75-
*/
76-
77-
void gui_popup_pm_text(void)
78-
{
79-
/* gui_menu_popup (settings.MainWindowModule,
80-
NULL); */
81-
}
82-
#endif
83-
8459
static gboolean
8560
_popupmenu_requested_cb(XiphosHtml *html, gchar *uri, gpointer user_data)
8661
{

src/gtk/commentary_dialog.c

-70
Original file line numberDiff line numberDiff line change
@@ -78,33 +78,6 @@ static void on_dialog_destroy(GObject *object, DIALOG_DATA *d)
7878
dialog_freed = FALSE;
7979
}
8080

81-
#if 0
82-
// unneeded at this time. disabled to silence cppcheck.
83-
/******************************************************************************
84-
* Name
85-
* gui_close_comm_dialog
86-
*
87-
* Synopsis
88-
* #include "commentary_dialog.h"
89-
*
90-
* void gui_close_comm_dialog(DIALOG_DATA * d)
91-
*
92-
* Description
93-
*
94-
*
95-
* Return value
96-
* void
97-
*/
98-
99-
void gui_close_comm_dialog(DIALOG_DATA *d)
100-
{
101-
if (d->dialog) {
102-
dialog_freed = FALSE;
103-
gtk_widget_destroy(d->dialog);
104-
}
105-
}
106-
#endif
107-
10881
/******************************************************************************
10982
* Name
11083
* on_dialog_motion_notify_event
@@ -130,32 +103,6 @@ static gboolean on_dialog_motion_notify_event(GtkWidget *widget,
130103
return FALSE;
131104
}
132105

133-
#if 0
134-
/******************************************************************************
135-
* Name
136-
* sync_with_main
137-
*
138-
* Synopsis
139-
* #include "gui/commentary_dialog.h"
140-
*
141-
* void sync_with_main(DIALOG_DATA * d)
142-
*
143-
* Descriptiond->navbar.lookup_entry
144-
* bring the the View Commentay Dialog module into sync with main window
145-
*
146-
* Return value
147-
* void
148-
*/
149-
150-
static void sync_with_main(DIALOG_DATA *d)
151-
{
152-
gchar *url = g_strdup_printf("sword:///%s", settings.currentverse);
153-
main_dialogs_url_handler(d, url, TRUE);
154-
cur_d = d;
155-
g_free(url);
156-
}
157-
#endif
158-
159106
/******************************************************************************
160107
* Name
161108
* create_nav_toolbar
@@ -276,20 +223,3 @@ void gui_create_commentary_dialog(DIALOG_DATA *d, gboolean do_edit)
276223
"motion_notify_event",
277224
G_CALLBACK(on_dialog_motion_notify_event), d);
278225
}
279-
280-
#if 0
281-
// unneeded at this time. disabled to silence cppcheck.
282-
void gui_commentary_dialog_sync_toggled(GtkToggleButton *button,
283-
DIALOG_DATA *d)
284-
{
285-
if (d == NULL)
286-
d = cur_d;
287-
if (gtk_toggle_button_get_active(button)) {
288-
sync_with_main(d);
289-
d->sync = TRUE;
290-
} else
291-
d->sync = FALSE;
292-
}
293-
#endif
294-
295-
/****** end of file ******/

src/gtk/dictlex.c

-68
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,6 @@ void gui_get_clipboard_text_for_lookup(GtkClipboard *clipboard,
113113
g_free(dict);
114114
}
115115

116-
#if 0
117-
static void set_label(gchar * mod_name)
118-
{
119-
gtk_label_set_text(GTK_LABEL(widgets.label_dict), mod_name);
120-
121-
}
122-
#endif
123-
124116
/******************************************************************************
125117
* Name
126118
* on_entryDictLookup_changed
@@ -143,66 +135,6 @@ void on_entryDictLookup_changed(GtkEditable *editable, gpointer data)
143135
main_dictionary_entry_changed(settings.DictWindowModule);
144136
}
145137

146-
#if 0
147-
// unneeded at this time. disabled to silence cppcheck.
148-
/******************************************************************************
149-
* Name
150-
* gui_display_dictlex
151-
*
152-
* Synopsis
153-
* #include "dictlex.h"
154-
*
155-
* void gui_display_dictlex(gchar * key)
156-
*
157-
* Description
158-
*
159-
*
160-
* Return value
161-
* void
162-
*/
163-
164-
void gui_display_dictlex(gchar *key)
165-
{
166-
gtk_entry_set_text(GTK_ENTRY(widgets.entry_dict), key);
167-
}
168-
#endif
169-
170-
#if 0
171-
// unneeded at this time. disabled to silence cppcheck.
172-
/******************************************************************************
173-
* Name
174-
* gui_set_dictlex_mod_and_key
175-
*
176-
* Synopsis
177-
* #include "_dictlex.h"
178-
*
179-
* void gui_set_dictlex_mod_and_key(gchar *mod, gchar *key)
180-
*
181-
* Description
182-
* sets the dictionary module and key. Primarily added for use in tabbed browsing
183-
*
184-
* Return value
185-
* void
186-
*/
187-
188-
void gui_set_dictlex_mod_and_key(gchar *mod_name, gchar *key)
189-
{
190-
const gchar *old_key;
191-
192-
//xml_set_value("Xiphos", "modules", "dict", mod_name);
193-
//settings.DictWindowModule = xml_get_value("modules", "dict");
194-
//set_label(settings.DictWindowModule);
195-
if (key == NULL)
196-
key = "Grace";
197-
198-
old_key = gtk_entry_get_text(GTK_ENTRY(widgets.entry_dict));
199-
if (!strcmp(old_key, key))
200-
on_entryDictLookup_changed(NULL, NULL);
201-
else
202-
gtk_entry_set_text(GTK_ENTRY(widgets.entry_dict), key);
203-
}
204-
#endif
205-
206138
void dict_key_entry_changed(GtkEntry *entry, gpointer data)
207139
{
208140
gchar *buf = NULL;

0 commit comments

Comments
 (0)